Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:12:00

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2023 Google LLC.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 #ifndef GOOGLE_PROTOBUF_COMPILER_RUST_ACCESSORS_ACCESSOR_CASE_H__
0009 #define GOOGLE_PROTOBUF_COMPILER_RUST_ACCESSORS_ACCESSOR_CASE_H__
0010 
0011 #include "absl/strings/string_view.h"
0012 
0013 namespace google {
0014 namespace protobuf {
0015 namespace compiler {
0016 namespace rust {
0017 
0018 // GenerateAccessorMsgImpl is reused for all three types of $Msg$, $Msg$Mut and
0019 // $Msg$View; this enum signifies which case we are handling so corresponding
0020 // adjustments can be made (for example: to not emit any mutation accessors
0021 // on $Msg$View).
0022 enum class AccessorCase {
0023   OWNED,
0024   MUT,
0025   VIEW,
0026 };
0027 
0028 // Returns the `self` receiver type for a subfield view accessor.
0029 absl::string_view ViewReceiver(AccessorCase accessor_case);
0030 
0031 // Returns the lifetime of a subfield view accessor.
0032 // Views are Copy, and so the full `'msg` lifetime can be used.
0033 // Any `&self` or `&mut self` accessors need to use the lifetime of that
0034 // borrow, which is referenced via `'_`.
0035 // See b/314989133 for _mut accessors.
0036 absl::string_view ViewLifetime(AccessorCase accessor_case);
0037 
0038 }  // namespace rust
0039 }  // namespace compiler
0040 }  // namespace protobuf
0041 }  // namespace google
0042 
0043 #endif  // GOOGLE_PROTOBUF_COMPILER_RUST_ACCESSORS_ACCESSOR_CASE_H__