• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef GOOGLE_PROTOBUF_COMPILER_RUST_RUST_FIELD_TYPE_H__
2 #define GOOGLE_PROTOBUF_COMPILER_RUST_RUST_FIELD_TYPE_H__
3 
4 #include "google/protobuf/descriptor.h"
5 
6 namespace google {
7 namespace protobuf {
8 namespace compiler {
9 namespace rust {
10 
11 // An enum of all of the singular types as they should be seen by Rust. This
12 // is parallel to FieldDescriptor::CppType with the main difference being that
13 // that String and Bytes are treated as different types.
14 enum class RustFieldType {
15   INT32,
16   INT64,
17   UINT32,
18   UINT64,
19   DOUBLE,
20   FLOAT,
21   BOOL,
22   ENUM,
23   STRING,
24   BYTES,
25   MESSAGE,
26 };
27 
28 // Note: for 'repeated X field' this returns the corresponding type of X.
29 // For map fields this returns MESSAGE.
30 RustFieldType GetRustFieldType(const FieldDescriptor& field);
31 
32 RustFieldType GetRustFieldType(FieldDescriptor::Type type);
33 
34 }  // namespace rust
35 }  // namespace compiler
36 }  // namespace protobuf
37 }  // namespace google
38 
39 #endif  // GOOGLE_PROTOBUF_COMPILER_RUST_RUST_FIELD_TYPE_H__
40