Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef GOOGLE_PROTOBUF_COMPILER_RUST_MAPPING_FILE_H__
0002 #define GOOGLE_PROTOBUF_COMPILER_RUST_MAPPING_FILE_H__
0003 
0004 #include <string>
0005 
0006 #include "absl/container/flat_hash_map.h"
0007 #include "absl/status/statusor.h"
0008 #include "google/protobuf/compiler/rust/context.h"
0009 
0010 namespace google {
0011 namespace protobuf {
0012 namespace compiler {
0013 namespace rust {
0014 
0015 // Returns a map from import path of a .proto file to the name of the crate
0016 // (proto_library) covering that file.
0017 //
0018 // This function parses a .rust_crate_mapping file generated by Bazel. The file
0019 // contains:
0020 //
0021 //    <crate_name>\n
0022 //    <number of .proto files covered by the proto_library with that name>\n
0023 //    <import path of the first .proto file of the proto_library>\n
0024 //    ...
0025 //    <import path of the last .proto file of the proto_library>\n
0026 //
0027 // repeated for each proto_library transitively reachable from the current
0028 // proto_library.
0029 //
0030 //  Note that the logic of translating the proto_library label to a crate name
0031 //  is handled by the build system completely, protoc is only given the end
0032 //  results. See `_render_text_crate_mapping` in
0033 //  //third_party/protobuf/rust:aspects.bzl for how Bazel does this.
0034 absl::StatusOr<absl::flat_hash_map<std::string, std::string>>
0035 GetImportPathToCrateNameMap(const Options* opts);
0036 
0037 }  // namespace rust
0038 }  // namespace compiler
0039 }  // namespace protobuf
0040 }  // namespace google
0041 
0042 #endif  // GOOGLE_PROTOBUF_COMPILER_RUST_MAPPING_FILE_H__