• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2023 Google LLC.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 #ifndef GOOGLE_PROTOBUF_COMPILER_RUST_ACCESSORS_HELPERS_H__
9 #define GOOGLE_PROTOBUF_COMPILER_RUST_ACCESSORS_HELPERS_H__
10 
11 #include <string>
12 
13 #include "google/protobuf/compiler/rust/context.h"
14 #include "google/protobuf/descriptor.h"
15 
16 namespace google {
17 namespace protobuf {
18 namespace compiler {
19 namespace rust {
20 
21 // Returns the field's default value as a Rust literal / identifier.
22 //
23 // Both strings and bytes are represented as a byte string literal, i.e. in the
24 // format `b"default value here"`. It is the caller's responsibility to convert
25 // the byte literal to an actual string, if needed.
26 std::string DefaultValue(Context& ctx, const FieldDescriptor& field);
27 
28 }  // namespace rust
29 }  // namespace compiler
30 }  // namespace protobuf
31 }  // namespace google
32 
33 #endif  // GOOGLE_PROTOBUF_COMPILER_RUST_ACCESSORS_HELPERS_H__
34