From fc7a772c2381230c1aaa78ee8f5444df38ec0967 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Mon, 12 Aug 2019 17:22:22 -0700 Subject: [PATCH 01/36] Make prost a `no_std` compatible library, and prost-build able to generate `no_std` code The alternative is to get collections types from `core` and `alloc`. In the `no_std` mode in `prost_build`, we force it to always use BTreeMap since HashMap was not stabilized in `alloc::collections` library. The functionality is identical and the only incompatibilities in the interface are that we cannot use `std::error::Error` or `std::io::Error` in `no_std` mode because these types have not been moved to `alloc` and there is no alternative. This also uprevs `bytes` dependency to 0.5, and fixes up breakage after IntoBuf api is removed in `bytes` crate. Note that for now, we put a patch to `bytes` to pin to a specific commit in master, since bytes `0.5` is not released yet. --- .travis.yml | 2 +- Cargo.toml | 12 +- conformance/Cargo.toml | 2 +- prost-build/Cargo.toml | 2 +- prost-build/src/code_generator.rs | 20 +- prost-build/src/lib.rs | 33 ++- prost-derive/src/field/group.rs | 2 +- prost-derive/src/field/map.rs | 16 +- prost-derive/src/field/message.rs | 2 +- prost-derive/src/lib.rs | 28 +-- prost-types/Cargo.toml | 8 +- prost-types/src/compiler.rs | 22 +- prost-types/src/lib.rs | 15 +- prost-types/src/protobuf.rs | 322 +++++++++++++++--------------- protobuf/Cargo.toml | 2 +- protobuf/src/lib.rs | 2 + src/encoding.rs | 26 ++- src/error.rs | 14 +- src/lib.rs | 16 +- src/message.rs | 29 +-- src/types.rs | 3 + tests-2015/Cargo.toml | 2 +- tests-alloc/Cargo.toml | 34 ++++ tests/Cargo.toml | 2 +- tests/src/build.rs | 13 +- tests/src/lib.rs | 2 +- 26 files changed, 383 insertions(+), 248 deletions(-) create mode 100644 tests-alloc/Cargo.toml diff --git a/.travis.yml b/.travis.yml index a393f0b9c..d9ada51ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ os: - osx rust: - - 1.32.0 + - 1.36.0 - nightly script: diff --git a/Cargo.toml b/Cargo.toml index 5521708b7..780fa414b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ members = [ "protobuf", "tests", "tests-2015", + "tests-alloc", ] exclude = [ # The fuzz crate can't be compiled or tested without the 'cargo fuzz' command, @@ -33,11 +34,15 @@ exclude = [ ] [features] -default = ["prost-derive"] +default = ["prost-derive", "std"] no-recursion-limit = [] +std = [] + # When std is disabled, we attempt to provide no_std support in prost + # Config::use_alloc_collections() should be set when using prost_build in your build.rs + # so that generated files will not have std:: either, and will use alloc crate instead [dependencies] -bytes = "0.4.7" +bytes = { version = "0.5", default-features = false } prost-derive = { version = "0.5.0", path = "prost-derive", optional = true } [dev-dependencies] @@ -54,3 +59,6 @@ name = "varint" [[bench]] name = "benchmark" harness = false + +[patch.crates-io] +bytes = { git = "https://github.com/tokio-rs/bytes", rev = "c17e40115f5bb2a2db71ed90dceae6ec643dc024" } diff --git a/conformance/Cargo.toml b/conformance/Cargo.toml index 94dbeb95d..c7963b479 100644 --- a/conformance/Cargo.toml +++ b/conformance/Cargo.toml @@ -6,7 +6,7 @@ publish = false edition = "2018" [dependencies] -bytes = "0.4.7" +bytes = "0.5" env_logger = { version = "0.6", default-features = false } log = "0.3" prost = { path = ".." } diff --git a/prost-build/Cargo.toml b/prost-build/Cargo.toml index 008110768..6c43137dc 100644 --- a/prost-build/Cargo.toml +++ b/prost-build/Cargo.toml @@ -11,7 +11,7 @@ description = "A Protocol Buffers implementation for the Rust Language." edition = "2018" [dependencies] -bytes = "0.4.7" +bytes = { version = "0.5", default-features = false } heck = "0.3" itertools = "0.8" log = "0.4" diff --git a/prost-build/src/code_generator.rs b/prost-build/src/code_generator.rs index 593bba807..7afbbc3d7 100644 --- a/prost-build/src/code_generator.rs +++ b/prost-build/src/code_generator.rs @@ -17,6 +17,7 @@ use crate::ast::{Comments, Method, Service}; use crate::extern_paths::ExternPaths; use crate::ident::{match_ident, to_snake, to_upper_camel}; use crate::message_graph::MessageGraph; +use crate::CollectionsLib; use crate::Config; #[derive(PartialEq)] @@ -366,12 +367,14 @@ impl<'a> CodeGenerator<'a> { self.buf.push_str(&to_snake(field.name())); self.buf.push_str(": "); if repeated { - self.buf.push_str("::std::vec::Vec<"); + self.buf.push_str(self.config.collections_lib.to_str()); + self.buf.push_str("::vec::Vec<"); } else if optional { - self.buf.push_str("::std::option::Option<"); + self.buf.push_str("::core::option::Option<"); } if boxed { - self.buf.push_str("::std::boxed::Box<"); + self.buf.push_str(self.config.collections_lib.to_str()); + self.buf.push_str("::boxed::Box<"); } self.buf.push_str(&ty); if boxed { @@ -403,7 +406,7 @@ impl<'a> CodeGenerator<'a> { self.append_doc(); self.push_indent(); - let btree_map = self + let btree_map = (self.config.collections_lib != CollectionsLib::Std) || self .config .btree_map .iter() @@ -426,8 +429,9 @@ impl<'a> CodeGenerator<'a> { self.append_field_attributes(msg_name, field.name()); self.push_indent(); self.buf.push_str(&format!( - "pub {}: ::std::collections::{}<{}, {}>,\n", + "pub {}: {}::collections::{}<{}, {}>,\n", to_snake(field.name()), + self.config.collections_lib.to_str(), rust_ty, key_ty, value_ty @@ -459,7 +463,7 @@ impl<'a> CodeGenerator<'a> { self.append_field_attributes(fq_message_name, oneof.name()); self.push_indent(); self.buf.push_str(&format!( - "pub {}: ::std::option::Option<{}>,\n", + "pub {}: ::core::option::Option<{}>,\n", to_snake(oneof.name()), name )); @@ -713,8 +717,8 @@ impl<'a> CodeGenerator<'a> { Type::Int32 | Type::Sfixed32 | Type::Sint32 | Type::Enum => String::from("i32"), Type::Int64 | Type::Sfixed64 | Type::Sint64 => String::from("i64"), Type::Bool => String::from("bool"), - Type::String => String::from("std::string::String"), - Type::Bytes => String::from("std::vec::Vec"), + Type::String => format!("{}::string::String", self.config.collections_lib.to_str()), + Type::Bytes => format!("{}::vec::Vec", self.config.collections_lib.to_str()), Type::Group | Type::Message => self.resolve_ident(field.type_name()), } } diff --git a/prost-build/src/lib.rs b/prost-build/src/lib.rs index fb5e68d17..69754ea41 100644 --- a/prost-build/src/lib.rs +++ b/prost-build/src/lib.rs @@ -165,11 +165,32 @@ pub trait ServiceGenerator { fn finalize(&mut self, _buf: &mut String) {} } +/// Configuration enum for whether to use `std` prefixes or `alloc` prefixes in generated code +/// +/// This option also forces Btree everywhere, overriding the BtreeMap options, +/// since HashMap is not in alloc::collections, only std (it requires randomness) +/// +#[derive(PartialEq)] +pub enum CollectionsLib { + Std, + Alloc, +} + +impl CollectionsLib { + pub fn to_str(&self) -> &'static str { + match self { + CollectionsLib::Std => { "::std" }, + CollectionsLib::Alloc => { "::alloc" }, + } + } +} + /// Configuration options for Protobuf code generation. /// /// This configuration builder can be used to set non-default code generation options. pub struct Config { service_generator: Option>, + collections_lib: CollectionsLib, btree_map: Vec, type_attributes: Vec<(String, String)>, field_attributes: Vec<(String, String)>, @@ -460,6 +481,15 @@ impl Config { self } + /// Configure the code generator to use the `::alloc` namespace rather than `::std`, and Btree everywhere + /// rather than `std`. + /// + /// This allows generated code to be used in a `#![no_std]` crate + pub fn use_alloc_collections_lib(&mut self) -> &mut Self { + self.collections_lib = CollectionsLib::Alloc; + self + } + /// Configures the output directory where generated Rust files will be written. /// /// If unset, defaults to the `OUT_DIR` environment variable. `OUT_DIR` is set by Cargo when @@ -538,7 +568,7 @@ impl Config { let mut buf = Vec::new(); fs::File::open(descriptor_set)?.read_to_end(&mut buf)?; - let descriptor_set = FileDescriptorSet::decode(&buf)?; + let descriptor_set = FileDescriptorSet::decode(&buf[..])?; let modules = self.generate(descriptor_set.file)?; for (module, content) in modules { @@ -581,6 +611,7 @@ impl default::Default for Config { fn default() -> Config { Config { service_generator: None, + collections_lib: CollectionsLib::Std, btree_map: Vec::new(), type_attributes: Vec::new(), field_attributes: Vec::new(), diff --git a/prost-derive/src/field/group.rs b/prost-derive/src/field/group.rs index 0197e753e..b0e9a33d3 100644 --- a/prost-derive/src/field/group.rs +++ b/prost-derive/src/field/group.rs @@ -120,7 +120,7 @@ impl Field { pub fn clear(&self, ident: TokenStream) -> TokenStream { match self.label { - Label::Optional => quote!(#ident = ::std::option::Option::None), + Label::Optional => quote!(#ident = ::core::option::Option::None), Label::Required => quote!(#ident.clear()), Label::Repeated => quote!(#ident.clear()), } diff --git a/prost-derive/src/field/map.rs b/prost-derive/src/field/map.rs index 07f3cf9d0..ed8d3e9b3 100644 --- a/prost-derive/src/field/map.rs +++ b/prost-derive/src/field/map.rs @@ -223,10 +223,10 @@ impl Field { }; Some(quote! { - pub fn #get(&self, key: #key_ref_ty) -> ::std::option::Option<#ty> { + pub fn #get(&self, key: #key_ref_ty) -> ::core::option::Option<#ty> { self.#ident.get(#take_ref key).cloned().and_then(#ty::from_i32) } - pub fn #insert(&mut self, key: #key_ty, value: #ty) -> ::std::option::Option<#ty> { + pub fn #insert(&mut self, key: #key_ty, value: #ty) -> ::core::option::Option<#ty> { self.#ident.insert(key, value as i32).and_then(#ty::from_i32) } }) @@ -249,7 +249,7 @@ impl Field { let key = self.key_ty.rust_type(); let value_wrapper = self.value_ty.debug(); let fmt = quote! { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { #key_wrapper #value_wrapper let mut builder = f.debug_map(); @@ -263,17 +263,17 @@ impl Field { ValueTy::Scalar(ref ty) => { let value = ty.rust_type(); quote! { - struct #wrapper_name<'a>(&'a ::std::collections::#type_name<#key, #value>); - impl<'a> ::std::fmt::Debug for #wrapper_name<'a> { + struct #wrapper_name<'a>(&'a ::alloc::collections::#type_name<#key, #value>); + impl<'a> ::core::fmt::Debug for #wrapper_name<'a> { #fmt } } } ValueTy::Message => quote! { - struct #wrapper_name<'a, V: 'a>(&'a ::std::collections::#type_name<#key, V>); - impl<'a, V> ::std::fmt::Debug for #wrapper_name<'a, V> + struct #wrapper_name<'a, V: 'a>(&'a ::alloc::collections::#type_name<#key, V>); + impl<'a, V> ::core::fmt::Debug for #wrapper_name<'a, V> where - V: ::std::fmt::Debug + 'a, + V: ::core::fmt::Debug + 'a, { #fmt } diff --git a/prost-derive/src/field/message.rs b/prost-derive/src/field/message.rs index 6d6ecd46f..1d3b1f041 100644 --- a/prost-derive/src/field/message.rs +++ b/prost-derive/src/field/message.rs @@ -123,7 +123,7 @@ impl Field { pub fn clear(&self, ident: TokenStream) -> TokenStream { match self.label { - Label::Optional => quote!(#ident = ::std::option::Option::None), + Label::Optional => quote!(#ident = ::core::option::Option::None), Label::Required => quote!(#ident.clear()), Label::Repeated => quote!(#ident.clear()), } diff --git a/prost-derive/src/lib.rs b/prost-derive/src/lib.rs index 6f1b4c027..609cf07c7 100644 --- a/prost-derive/src/lib.rs +++ b/prost-derive/src/lib.rs @@ -191,7 +191,7 @@ fn try_message(input: TokenStream) -> Result { wire_type: _prost::encoding::WireType, buf: &mut B, ctx: _prost::encoding::DecodeContext, - ) -> ::std::result::Result<(), _prost::DecodeError> + ) -> ::core::result::Result<(), _prost::DecodeError> where B: _bytes::Buf { #struct_name match tag { @@ -218,8 +218,8 @@ fn try_message(input: TokenStream) -> Result { } } - impl ::std::fmt::Debug for #ident { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + impl ::core::fmt::Debug for #ident { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { let mut builder = #debug_builder; #(#debugs;)* builder.finish() @@ -286,7 +286,7 @@ fn try_enumeration(input: TokenStream) -> Result { .iter() .map(|&(_, ref value)| quote!(#value => true)); let from = variants.iter().map( - |&(ref variant, ref value)| quote!(#value => ::std::option::Option::Some(#ident::#variant)), + |&(ref variant, ref value)| quote!(#value => ::core::option::Option::Some(#ident::#variant)), ); let is_valid_doc = format!("Returns `true` if `value` is a variant of `{}`.", ident); @@ -309,21 +309,21 @@ fn try_enumeration(input: TokenStream) -> Result { } #[doc=#from_i32_doc] - pub fn from_i32(value: i32) -> ::std::option::Option<#ident> { + pub fn from_i32(value: i32) -> ::core::option::Option<#ident> { match value { #(#from,)* - _ => ::std::option::Option::None, + _ => ::core::option::Option::None, } } } - impl ::std::default::Default for #ident { + impl ::core::default::Default for #ident { fn default() -> #ident { #ident::#default } } - impl ::std::convert::From<#ident> for i32 { + impl ::core::convert::From<#ident> for i32 { fn from(value: #ident) -> i32 { value as i32 } @@ -411,8 +411,8 @@ fn try_oneof(input: TokenStream) -> Result { let merge = field.merge(quote!(value)); quote! { #tag => { - let mut value = ::std::default::Default::default(); - #merge.map(|_| *field = ::std::option::Option::Some(#ident::#variant_ident(value))) + let mut value = ::core::default::Default::default(); + #merge.map(|_| *field = ::core::option::Option::Some(#ident::#variant_ident(value))) } } }); @@ -445,12 +445,12 @@ fn try_oneof(input: TokenStream) -> Result { } } - pub fn merge(field: &mut ::std::option::Option<#ident>, + pub fn merge(field: &mut ::core::option::Option<#ident>, tag: u32, wire_type: _prost::encoding::WireType, buf: &mut B, ctx: _prost::encoding::DecodeContext, - ) -> ::std::result::Result<(), _prost::DecodeError> + ) -> ::core::result::Result<(), _prost::DecodeError> where B: _bytes::Buf { match tag { #(#merge,)* @@ -466,8 +466,8 @@ fn try_oneof(input: TokenStream) -> Result { } } - impl ::std::fmt::Debug for #ident { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + impl ::core::fmt::Debug for #ident { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match *self { #(#debug,)* } diff --git a/prost-types/Cargo.toml b/prost-types/Cargo.toml index 24415d32b..9c0eefae8 100644 --- a/prost-types/Cargo.toml +++ b/prost-types/Cargo.toml @@ -14,6 +14,10 @@ edition = "2018" doctest = false test = false +[features] +default = ["std"] +std = [] + [dependencies] -bytes = "0.4.7" -prost = { version = "0.5.0", path = ".." } +bytes = { version = "0.5", default-features = false } +prost = { version = "0.5.0", path = "..", default-features = false } diff --git a/prost-types/src/compiler.rs b/prost-types/src/compiler.rs index 421bd78ba..c7477eab8 100644 --- a/prost-types/src/compiler.rs +++ b/prost-types/src/compiler.rs @@ -2,15 +2,15 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct Version { #[prost(int32, optional, tag="1")] - pub major: ::std::option::Option, + pub major: ::core::option::Option, #[prost(int32, optional, tag="2")] - pub minor: ::std::option::Option, + pub minor: ::core::option::Option, #[prost(int32, optional, tag="3")] - pub patch: ::std::option::Option, + pub patch: ::core::option::Option, /// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should /// be empty for mainline stable releases. #[prost(string, optional, tag="4")] - pub suffix: ::std::option::Option, + pub suffix: ::core::option::Option, } /// An encoded CodeGeneratorRequest is written to the plugin's stdin. #[derive(Clone, PartialEq, ::prost::Message)] @@ -19,10 +19,10 @@ pub struct CodeGeneratorRequest { /// code generator should generate code only for these files. Each file's /// descriptor will be included in proto_file, below. #[prost(string, repeated, tag="1")] - pub file_to_generate: ::std::vec::Vec, + pub file_to_generate: ::std::vec::Vec, /// The generator parameter passed on the command-line. #[prost(string, optional, tag="2")] - pub parameter: ::std::option::Option, + pub parameter: ::core::option::Option, /// FileDescriptorProtos for all files in files_to_generate and everything /// they import. The files will appear in topological order, so each file /// appears before any file that imports it. @@ -41,7 +41,7 @@ pub struct CodeGeneratorRequest { pub proto_file: ::std::vec::Vec, /// The version number of protocol compiler. #[prost(message, optional, tag="3")] - pub compiler_version: ::std::option::Option, + pub compiler_version: ::core::option::Option, } /// The plugin writes an encoded CodeGeneratorResponse to stdout. #[derive(Clone, PartialEq, ::prost::Message)] @@ -55,7 +55,7 @@ pub struct CodeGeneratorResponse { /// unparseable -- should be reported by writing a message to stderr and /// exiting with a non-zero status code. #[prost(string, optional, tag="1")] - pub error: ::std::option::Option, + pub error: ::core::option::Option, #[prost(message, repeated, tag="15")] pub file: ::std::vec::Vec, } @@ -75,7 +75,7 @@ pub mod code_generator_response { /// this writing protoc does not optimize for this -- it will read the entire /// CodeGeneratorResponse before writing files to disk. #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, /// If non-empty, indicates that the named file should already exist, and the /// content here is to be inserted into that file at a defined insertion /// point. This feature allows a code generator to extend the output @@ -114,9 +114,9 @@ pub mod code_generator_response { /// /// If |insertion_point| is present, |name| must also be present. #[prost(string, optional, tag="2")] - pub insertion_point: ::std::option::Option, + pub insertion_point: ::core::option::Option, /// The file contents. #[prost(string, optional, tag="15")] - pub content: ::std::option::Option, + pub content: ::core::option::Option, } } diff --git a/prost-types/src/lib.rs b/prost-types/src/lib.rs index 6796d4af2..62ff534ef 100644 --- a/prost-types/src/lib.rs +++ b/prost-types/src/lib.rs @@ -9,8 +9,15 @@ //! //! [1]: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf -use std::i32; -use std::i64; +#![no_std] +extern crate alloc; +#[cfg(feature = "std")] +extern crate std; + +use core::i32; +use core::i64; + +#[cfg(feature = "std")] use std::time; include!("protobuf.rs"); @@ -51,6 +58,7 @@ impl Duration { } /// Converts a `std::time::Duration` to a `Duration`. +#[cfg(feature = "std")] impl From for Duration { fn from(duration: time::Duration) -> Duration { let seconds = duration.as_secs(); @@ -74,6 +82,7 @@ impl From for Duration { /// Converts a `Duration` to a result containing a positive (`Ok`) or negative (`Err`) /// `std::time::Duration`. // TODO: convert this to TryFrom when it's stable. +#[cfg(feature = "std")] impl From for Result { fn from(mut duration: Duration) -> Result { duration.normalize(); @@ -116,6 +125,7 @@ impl Timestamp { } /// Converts a `std::time::SystemTime` to a `Timestamp`. +#[cfg(feature = "std")] impl From for Timestamp { fn from(time: time::SystemTime) -> Timestamp { let duration = Duration::from(time.duration_since(time::UNIX_EPOCH).unwrap()); @@ -129,6 +139,7 @@ impl From for Timestamp { /// Converts a `Timestamp` to a `SystemTime`, or if the timestamp falls before the Unix epoch, a /// duration containing the difference. // TODO: convert this to TryFrom when it's stable. +#[cfg(feature = "std")] impl From for Result { fn from(mut timestamp: Timestamp) -> Result { timestamp.normalize(); diff --git a/prost-types/src/protobuf.rs b/prost-types/src/protobuf.rs index 07a70e61c..8324b0d72 100644 --- a/prost-types/src/protobuf.rs +++ b/prost-types/src/protobuf.rs @@ -3,84 +3,84 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct FileDescriptorSet { #[prost(message, repeated, tag="1")] - pub file: ::std::vec::Vec, + pub file: ::alloc::vec::Vec, } /// Describes a complete .proto file. #[derive(Clone, PartialEq, ::prost::Message)] pub struct FileDescriptorProto { /// file name, relative to root of source tree #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, /// e.g. "foo", "foo.bar", etc. #[prost(string, optional, tag="2")] - pub package: ::std::option::Option, + pub package: ::core::option::Option, /// Names of files imported by this file. #[prost(string, repeated, tag="3")] - pub dependency: ::std::vec::Vec, + pub dependency: ::alloc::vec::Vec, /// Indexes of the public imported files in the dependency list above. #[prost(int32, repeated, packed="false", tag="10")] - pub public_dependency: ::std::vec::Vec, + pub public_dependency: ::alloc::vec::Vec, /// Indexes of the weak imported files in the dependency list. /// For Google-internal migration only. Do not use. #[prost(int32, repeated, packed="false", tag="11")] - pub weak_dependency: ::std::vec::Vec, + pub weak_dependency: ::alloc::vec::Vec, /// All top-level definitions in this file. #[prost(message, repeated, tag="4")] - pub message_type: ::std::vec::Vec, + pub message_type: ::alloc::vec::Vec, #[prost(message, repeated, tag="5")] - pub enum_type: ::std::vec::Vec, + pub enum_type: ::alloc::vec::Vec, #[prost(message, repeated, tag="6")] - pub service: ::std::vec::Vec, + pub service: ::alloc::vec::Vec, #[prost(message, repeated, tag="7")] - pub extension: ::std::vec::Vec, + pub extension: ::alloc::vec::Vec, #[prost(message, optional, tag="8")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, /// This field contains optional information about the original source code. /// You may safely remove this entire field without harming runtime /// functionality of the descriptors -- the information is needed only by /// development tools. #[prost(message, optional, tag="9")] - pub source_code_info: ::std::option::Option, + pub source_code_info: ::core::option::Option, /// The syntax of the proto file. /// The supported values are "proto2" and "proto3". #[prost(string, optional, tag="12")] - pub syntax: ::std::option::Option, + pub syntax: ::core::option::Option, } /// Describes a message type. #[derive(Clone, PartialEq, ::prost::Message)] pub struct DescriptorProto { #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, #[prost(message, repeated, tag="2")] - pub field: ::std::vec::Vec, + pub field: ::alloc::vec::Vec, #[prost(message, repeated, tag="6")] - pub extension: ::std::vec::Vec, + pub extension: ::alloc::vec::Vec, #[prost(message, repeated, tag="3")] - pub nested_type: ::std::vec::Vec, + pub nested_type: ::alloc::vec::Vec, #[prost(message, repeated, tag="4")] - pub enum_type: ::std::vec::Vec, + pub enum_type: ::alloc::vec::Vec, #[prost(message, repeated, tag="5")] - pub extension_range: ::std::vec::Vec, + pub extension_range: ::alloc::vec::Vec, #[prost(message, repeated, tag="8")] - pub oneof_decl: ::std::vec::Vec, + pub oneof_decl: ::alloc::vec::Vec, #[prost(message, optional, tag="7")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, #[prost(message, repeated, tag="9")] - pub reserved_range: ::std::vec::Vec, + pub reserved_range: ::alloc::vec::Vec, /// Reserved field names, which may not be used by fields in the same message. /// A given name may only be reserved once. #[prost(string, repeated, tag="10")] - pub reserved_name: ::std::vec::Vec, + pub reserved_name: ::alloc::vec::Vec, } pub mod descriptor_proto { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExtensionRange { #[prost(int32, optional, tag="1")] - pub start: ::std::option::Option, + pub start: ::core::option::Option, #[prost(int32, optional, tag="2")] - pub end: ::std::option::Option, + pub end: ::core::option::Option, #[prost(message, optional, tag="3")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, } /// Range of reserved tag numbers. Reserved tag numbers may not be used by /// fields or extension ranges in the same message. Reserved ranges may @@ -89,61 +89,61 @@ pub mod descriptor_proto { pub struct ReservedRange { /// Inclusive. #[prost(int32, optional, tag="1")] - pub start: ::std::option::Option, + pub start: ::core::option::Option, /// Exclusive. #[prost(int32, optional, tag="2")] - pub end: ::std::option::Option, + pub end: ::core::option::Option, } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExtensionRangeOptions { /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } /// Describes a field within a message. #[derive(Clone, PartialEq, ::prost::Message)] pub struct FieldDescriptorProto { #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, #[prost(int32, optional, tag="3")] - pub number: ::std::option::Option, + pub number: ::core::option::Option, #[prost(enumeration="field_descriptor_proto::Label", optional, tag="4")] - pub label: ::std::option::Option, + pub label: ::core::option::Option, /// If type_name is set, this need not be set. If both this and type_name /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. #[prost(enumeration="field_descriptor_proto::Type", optional, tag="5")] - pub r#type: ::std::option::Option, + pub r#type: ::core::option::Option, /// For message and enum types, this is the name of the type. If the name /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping /// rules are used to find the type (i.e. first the nested types within this /// message are searched, then within the parent, on up to the root /// namespace). #[prost(string, optional, tag="6")] - pub type_name: ::std::option::Option, + pub type_name: ::core::option::Option, /// For extensions, this is the name of the type being extended. It is /// resolved in the same manner as type_name. #[prost(string, optional, tag="2")] - pub extendee: ::std::option::Option, + pub extendee: ::core::option::Option, /// For numeric types, contains the original text representation of the value. /// For booleans, "true" or "false". /// For strings, contains the default text contents (not escaped in any way). /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. /// TODO(kenton): Base-64 encode? #[prost(string, optional, tag="7")] - pub default_value: ::std::option::Option, + pub default_value: ::core::option::Option, /// If set, gives the index of a oneof in the containing type's oneof_decl /// list. This field is a member of that oneof. #[prost(int32, optional, tag="9")] - pub oneof_index: ::std::option::Option, + pub oneof_index: ::core::option::Option, /// JSON name of this field. The value is set by protocol compiler. If the /// user has set a "json_name" option on this field, that option's value /// will be used. Otherwise, it's deduced from the field's name by converting /// it to camelCase. #[prost(string, optional, tag="10")] - pub json_name: ::std::option::Option, + pub json_name: ::core::option::Option, #[prost(message, optional, tag="8")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, } pub mod field_descriptor_proto { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] @@ -195,28 +195,28 @@ pub mod field_descriptor_proto { #[derive(Clone, PartialEq, ::prost::Message)] pub struct OneofDescriptorProto { #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, #[prost(message, optional, tag="2")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, } /// Describes an enum type. #[derive(Clone, PartialEq, ::prost::Message)] pub struct EnumDescriptorProto { #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, #[prost(message, repeated, tag="2")] - pub value: ::std::vec::Vec, + pub value: ::alloc::vec::Vec, #[prost(message, optional, tag="3")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, /// Range of reserved numeric values. Reserved numeric values may not be used /// by enum values in the same enum declaration. Reserved ranges may not /// overlap. #[prost(message, repeated, tag="4")] - pub reserved_range: ::std::vec::Vec, + pub reserved_range: ::alloc::vec::Vec, /// Reserved enum value names, which may not be reused. A given name may only /// be reserved once. #[prost(string, repeated, tag="5")] - pub reserved_name: ::std::vec::Vec, + pub reserved_name: ::alloc::vec::Vec, } pub mod enum_descriptor_proto { /// Range of reserved numeric values. Reserved values may not be used by @@ -229,51 +229,51 @@ pub mod enum_descriptor_proto { pub struct EnumReservedRange { /// Inclusive. #[prost(int32, optional, tag="1")] - pub start: ::std::option::Option, + pub start: ::core::option::Option, /// Inclusive. #[prost(int32, optional, tag="2")] - pub end: ::std::option::Option, + pub end: ::core::option::Option, } } /// Describes a value within an enum. #[derive(Clone, PartialEq, ::prost::Message)] pub struct EnumValueDescriptorProto { #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, #[prost(int32, optional, tag="2")] - pub number: ::std::option::Option, + pub number: ::core::option::Option, #[prost(message, optional, tag="3")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, } /// Describes a service. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ServiceDescriptorProto { #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, #[prost(message, repeated, tag="2")] - pub method: ::std::vec::Vec, + pub method: ::alloc::vec::Vec, #[prost(message, optional, tag="3")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, } /// Describes a method of a service. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MethodDescriptorProto { #[prost(string, optional, tag="1")] - pub name: ::std::option::Option, + pub name: ::core::option::Option, /// Input and output type names. These are resolved in the same way as /// FieldDescriptorProto.type_name, but must refer to a message type. #[prost(string, optional, tag="2")] - pub input_type: ::std::option::Option, + pub input_type: ::core::option::Option, #[prost(string, optional, tag="3")] - pub output_type: ::std::option::Option, + pub output_type: ::core::option::Option, #[prost(message, optional, tag="4")] - pub options: ::std::option::Option, + pub options: ::core::option::Option, /// Identifies if client streams multiple client messages #[prost(bool, optional, tag="5", default="false")] - pub client_streaming: ::std::option::Option, + pub client_streaming: ::core::option::Option, /// Identifies if server streams multiple server messages #[prost(bool, optional, tag="6", default="false")] - pub server_streaming: ::std::option::Option, + pub server_streaming: ::core::option::Option, } // =================================================================== // Options @@ -314,14 +314,14 @@ pub struct FileOptions { /// inappropriate because proto packages do not normally start with backwards /// domain names. #[prost(string, optional, tag="1")] - pub java_package: ::std::option::Option, + pub java_package: ::core::option::Option, /// If set, all the classes from the .proto file are wrapped in a single /// outer class with the given name. This applies to both Proto1 /// (equivalent to the old "--one_java_file" option) and Proto2 (where /// a .proto always translates to a single class, but you may want to /// explicitly choose the class name). #[prost(string, optional, tag="8")] - pub java_outer_classname: ::std::option::Option, + pub java_outer_classname: ::core::option::Option, /// If set true, then the Java code generator will generate a separate .java /// file for each top-level message, enum, and service defined in the .proto /// file. Thus, these types will *not* be nested inside the outer class @@ -329,10 +329,10 @@ pub struct FileOptions { /// generated to contain the file's getDescriptor() method as well as any /// top-level extensions defined in the file. #[prost(bool, optional, tag="10", default="false")] - pub java_multiple_files: ::std::option::Option, + pub java_multiple_files: ::core::option::Option, /// This option does nothing. #[prost(bool, optional, tag="20")] - pub java_generate_equals_and_hash: ::std::option::Option, + pub java_generate_equals_and_hash: ::core::option::Option, /// If set true, then the Java2 code generator will generate code that /// throws an exception whenever an attempt is made to assign a non-UTF-8 /// byte sequence to a string field. @@ -340,16 +340,16 @@ pub struct FileOptions { /// However, an extension field still accepts non-UTF-8 byte sequences. /// This option has no effect on when used with the lite runtime. #[prost(bool, optional, tag="27", default="false")] - pub java_string_check_utf8: ::std::option::Option, + pub java_string_check_utf8: ::core::option::Option, #[prost(enumeration="file_options::OptimizeMode", optional, tag="9", default="Speed")] - pub optimize_for: ::std::option::Option, + pub optimize_for: ::core::option::Option, /// Sets the Go package where structs generated from this .proto will be /// placed. If omitted, the Go package will be derived from the following: /// - The basename of the package import path, if provided. /// - Otherwise, the package statement in the .proto file, if present. /// - Otherwise, the basename of the .proto file, without extension. #[prost(string, optional, tag="11")] - pub go_package: ::std::option::Option, + pub go_package: ::core::option::Option, /// Should generic services be generated in each language? "Generic" services /// are not specific to any particular RPC system. They are generated by the /// main code generators in each language (without additional plugins). @@ -361,59 +361,59 @@ pub struct FileOptions { /// these default to false. Old code which depends on generic services should /// explicitly set them to true. #[prost(bool, optional, tag="16", default="false")] - pub cc_generic_services: ::std::option::Option, + pub cc_generic_services: ::core::option::Option, #[prost(bool, optional, tag="17", default="false")] - pub java_generic_services: ::std::option::Option, + pub java_generic_services: ::core::option::Option, #[prost(bool, optional, tag="18", default="false")] - pub py_generic_services: ::std::option::Option, + pub py_generic_services: ::core::option::Option, #[prost(bool, optional, tag="42", default="false")] - pub php_generic_services: ::std::option::Option, + pub php_generic_services: ::core::option::Option, /// Is this file deprecated? /// Depending on the target platform, this can emit Deprecated annotations /// for everything in the file, or it will be completely ignored; in the very /// least, this is a formalization for deprecating files. #[prost(bool, optional, tag="23", default="false")] - pub deprecated: ::std::option::Option, + pub deprecated: ::core::option::Option, /// Enables the use of arenas for the proto messages in this file. This applies /// only to generated classes for C++. #[prost(bool, optional, tag="31", default="false")] - pub cc_enable_arenas: ::std::option::Option, + pub cc_enable_arenas: ::core::option::Option, /// Sets the objective c class prefix which is prepended to all objective c /// generated classes from this .proto. There is no default. #[prost(string, optional, tag="36")] - pub objc_class_prefix: ::std::option::Option, + pub objc_class_prefix: ::core::option::Option, /// Namespace for generated classes; defaults to the package. #[prost(string, optional, tag="37")] - pub csharp_namespace: ::std::option::Option, + pub csharp_namespace: ::core::option::Option, /// By default Swift generators will take the proto package and CamelCase it /// replacing '.' with underscore and use that to prefix the types/symbols /// defined. When this options is provided, they will use this value instead /// to prefix the types/symbols defined. #[prost(string, optional, tag="39")] - pub swift_prefix: ::std::option::Option, + pub swift_prefix: ::core::option::Option, /// Sets the php class prefix which is prepended to all php generated classes /// from this .proto. Default is empty. #[prost(string, optional, tag="40")] - pub php_class_prefix: ::std::option::Option, + pub php_class_prefix: ::core::option::Option, /// Use this option to change the namespace of php generated classes. Default /// is empty. When this option is empty, the package name will be used for /// determining the namespace. #[prost(string, optional, tag="41")] - pub php_namespace: ::std::option::Option, + pub php_namespace: ::core::option::Option, /// Use this option to change the namespace of php generated metadata classes. /// Default is empty. When this option is empty, the proto file name will be used /// for determining the namespace. #[prost(string, optional, tag="44")] - pub php_metadata_namespace: ::std::option::Option, + pub php_metadata_namespace: ::core::option::Option, /// Use this option to change the package of ruby generated classes. Default /// is empty. When this option is not set, the package name will be used for /// determining the ruby package. #[prost(string, optional, tag="45")] - pub ruby_package: ::std::option::Option, + pub ruby_package: ::core::option::Option, /// The parser stores options it doesn't recognize here. /// See the documentation for the "Options" section above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } pub mod file_options { /// Generated classes can be optimized for speed or code size. @@ -451,18 +451,18 @@ pub struct MessageOptions { /// Because this is an option, the above two restrictions are not enforced by /// the protocol compiler. #[prost(bool, optional, tag="1", default="false")] - pub message_set_wire_format: ::std::option::Option, + pub message_set_wire_format: ::core::option::Option, /// Disables the generation of the standard "descriptor()" accessor, which can /// conflict with a field of the same name. This is meant to make migration /// from proto1 easier; new code should avoid fields named "descriptor". #[prost(bool, optional, tag="2", default="false")] - pub no_standard_descriptor_accessor: ::std::option::Option, + pub no_standard_descriptor_accessor: ::core::option::Option, /// Is this message deprecated? /// Depending on the target platform, this can emit Deprecated annotations /// for the message, or it will be completely ignored; in the very least, /// this is a formalization for deprecating messages. #[prost(bool, optional, tag="3", default="false")] - pub deprecated: ::std::option::Option, + pub deprecated: ::core::option::Option, /// Whether the message is an automatically generated map entry type for the /// maps field. /// @@ -485,10 +485,10 @@ pub struct MessageOptions { /// instead. The option should only be implicitly set by the proto compiler /// parser. #[prost(bool, optional, tag="7")] - pub map_entry: ::std::option::Option, + pub map_entry: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct FieldOptions { @@ -497,14 +497,14 @@ pub struct FieldOptions { /// options below. This option is not yet implemented in the open source /// release -- sorry, we'll try to include it in a future version! #[prost(enumeration="field_options::CType", optional, tag="1", default="String")] - pub ctype: ::std::option::Option, + pub ctype: ::core::option::Option, /// The packed option can be enabled for repeated primitive fields to enable /// a more efficient representation on the wire. Rather than repeatedly /// writing the tag and type for each element, the entire array is encoded as /// a single length-delimited blob. In proto3, only explicit setting it to /// false will avoid using packed encoding. #[prost(bool, optional, tag="2")] - pub packed: ::std::option::Option, + pub packed: ::core::option::Option, /// The jstype option determines the JavaScript type used for values of the /// field. The option is permitted only for 64 bit integral and fixed types /// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING @@ -517,7 +517,7 @@ pub struct FieldOptions { /// This option is an enum to permit additional types to be added, e.g. /// goog.math.Integer. #[prost(enumeration="field_options::JsType", optional, tag="6", default="JsNormal")] - pub jstype: ::std::option::Option, + pub jstype: ::core::option::Option, /// Should this field be parsed lazily? Lazy applies only to message-type /// fields. It means that when the outer message is initially parsed, the /// inner message's contents will not be parsed but instead stored in encoded @@ -547,19 +547,19 @@ pub struct FieldOptions { /// check its required fields, regardless of whether or not the message has /// been parsed. #[prost(bool, optional, tag="5", default="false")] - pub lazy: ::std::option::Option, + pub lazy: ::core::option::Option, /// Is this field deprecated? /// Depending on the target platform, this can emit Deprecated annotations /// for accessors, or it will be completely ignored; in the very least, this /// is a formalization for deprecating fields. #[prost(bool, optional, tag="3", default="false")] - pub deprecated: ::std::option::Option, + pub deprecated: ::core::option::Option, /// For Google-internal migration only. Do not use. #[prost(bool, optional, tag="10", default="false")] - pub weak: ::std::option::Option, + pub weak: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } pub mod field_options { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] @@ -585,23 +585,23 @@ pub mod field_options { pub struct OneofOptions { /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct EnumOptions { /// Set this option to true to allow mapping different tag names to the same /// value. #[prost(bool, optional, tag="2")] - pub allow_alias: ::std::option::Option, + pub allow_alias: ::core::option::Option, /// Is this enum deprecated? /// Depending on the target platform, this can emit Deprecated annotations /// for the enum, or it will be completely ignored; in the very least, this /// is a formalization for deprecating enums. #[prost(bool, optional, tag="3", default="false")] - pub deprecated: ::std::option::Option, + pub deprecated: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct EnumValueOptions { @@ -610,10 +610,10 @@ pub struct EnumValueOptions { /// for the enum value, or it will be completely ignored; in the very least, /// this is a formalization for deprecating enum values. #[prost(bool, optional, tag="1", default="false")] - pub deprecated: ::std::option::Option, + pub deprecated: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ServiceOptions { @@ -627,10 +627,10 @@ pub struct ServiceOptions { /// for the service, or it will be completely ignored; in the very least, /// this is a formalization for deprecating services. #[prost(bool, optional, tag="33", default="false")] - pub deprecated: ::std::option::Option, + pub deprecated: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct MethodOptions { @@ -644,12 +644,12 @@ pub struct MethodOptions { /// for the method, or it will be completely ignored; in the very least, /// this is a formalization for deprecating methods. #[prost(bool, optional, tag="33", default="false")] - pub deprecated: ::std::option::Option, + pub deprecated: ::core::option::Option, #[prost(enumeration="method_options::IdempotencyLevel", optional, tag="34", default="IdempotencyUnknown")] - pub idempotency_level: ::std::option::Option, + pub idempotency_level: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag="999")] - pub uninterpreted_option: ::std::vec::Vec, + pub uninterpreted_option: ::alloc::vec::Vec, } pub mod method_options { /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, @@ -674,21 +674,21 @@ pub mod method_options { #[derive(Clone, PartialEq, ::prost::Message)] pub struct UninterpretedOption { #[prost(message, repeated, tag="2")] - pub name: ::std::vec::Vec, + pub name: ::alloc::vec::Vec, /// The value of the uninterpreted option, in whatever type the tokenizer /// identified it as during parsing. Exactly one of these should be set. #[prost(string, optional, tag="3")] - pub identifier_value: ::std::option::Option, + pub identifier_value: ::core::option::Option, #[prost(uint64, optional, tag="4")] - pub positive_int_value: ::std::option::Option, + pub positive_int_value: ::core::option::Option, #[prost(int64, optional, tag="5")] - pub negative_int_value: ::std::option::Option, + pub negative_int_value: ::core::option::Option, #[prost(double, optional, tag="6")] - pub double_value: ::std::option::Option, + pub double_value: ::core::option::Option, #[prost(bytes, optional, tag="7")] - pub string_value: ::std::option::Option>, + pub string_value: ::core::option::Option>, #[prost(string, optional, tag="8")] - pub aggregate_value: ::std::option::Option, + pub aggregate_value: ::core::option::Option, } pub mod uninterpreted_option { /// The name of the uninterpreted option. Each string represents a segment in @@ -699,7 +699,7 @@ pub mod uninterpreted_option { #[derive(Clone, PartialEq, ::prost::Message)] pub struct NamePart { #[prost(string, required, tag="1")] - pub name_part: std::string::String, + pub name_part: alloc::string::String, #[prost(bool, required, tag="2")] pub is_extension: bool, } @@ -755,7 +755,7 @@ pub struct SourceCodeInfo { /// ignore those that it doesn't understand, as more types of locations could /// be recorded in the future. #[prost(message, repeated, tag="1")] - pub location: ::std::vec::Vec, + pub location: ::alloc::vec::Vec, } pub mod source_code_info { #[derive(Clone, PartialEq, ::prost::Message)] @@ -784,14 +784,14 @@ pub mod source_code_info { /// this path refers to the whole field declaration (from the beginning /// of the label to the terminating semicolon). #[prost(int32, repeated, tag="1")] - pub path: ::std::vec::Vec, + pub path: ::alloc::vec::Vec, /// Always has exactly three or four elements: start line, start column, /// end line (optional, otherwise assumed same as start line), end column. /// These are packed into a single field for efficiency. Note that line /// and column numbers are zero-based -- typically you will want to add /// 1 to each before displaying to a user. #[prost(int32, repeated, tag="2")] - pub span: ::std::vec::Vec, + pub span: ::alloc::vec::Vec, /// If this SourceCodeInfo represents a complete declaration, these are any /// comments appearing before and after the declaration which appear to be /// attached to the declaration. @@ -840,11 +840,11 @@ pub mod source_code_info { /// /// // ignored detached comments. #[prost(string, optional, tag="3")] - pub leading_comments: ::std::option::Option, + pub leading_comments: ::core::option::Option, #[prost(string, optional, tag="4")] - pub trailing_comments: ::std::option::Option, + pub trailing_comments: ::core::option::Option, #[prost(string, repeated, tag="6")] - pub leading_detached_comments: ::std::vec::Vec, + pub leading_detached_comments: ::alloc::vec::Vec, } } /// Describes the relationship between generated code and its original source @@ -855,7 +855,7 @@ pub struct GeneratedCodeInfo { /// An Annotation connects some span of text in generated code to an element /// of its generating .proto file. #[prost(message, repeated, tag="1")] - pub annotation: ::std::vec::Vec, + pub annotation: ::alloc::vec::Vec, } pub mod generated_code_info { #[derive(Clone, PartialEq, ::prost::Message)] @@ -863,19 +863,19 @@ pub mod generated_code_info { /// Identifies the element in the original source .proto file. This field /// is formatted the same as SourceCodeInfo.Location.path. #[prost(int32, repeated, tag="1")] - pub path: ::std::vec::Vec, + pub path: ::alloc::vec::Vec, /// Identifies the filesystem path to the original source .proto. #[prost(string, optional, tag="2")] - pub source_file: ::std::option::Option, + pub source_file: ::core::option::Option, /// Identifies the starting offset in bytes in the generated code /// that relates to the identified object. #[prost(int32, optional, tag="3")] - pub begin: ::std::option::Option, + pub begin: ::core::option::Option, /// Identifies the ending offset in bytes in the generated code that /// relates to the identified offset. The end offset should be one past /// the last relevant byte (so the length of the text = end - begin). #[prost(int32, optional, tag="4")] - pub end: ::std::option::Option, + pub end: ::core::option::Option, } } /// `Any` contains an arbitrary serialized protocol buffer message along with a @@ -989,10 +989,10 @@ pub struct Any { /// used with implementation specific semantics. /// #[prost(string, tag="1")] - pub type_url: std::string::String, + pub type_url: alloc::string::String, /// Must be a valid serialized protocol buffer of the above specified type. #[prost(bytes, tag="2")] - pub value: std::vec::Vec, + pub value: alloc::vec::Vec, } /// `SourceContext` represents information about the source of a /// protobuf element, like the file in which it is defined. @@ -1001,26 +1001,26 @@ pub struct SourceContext { /// The path-qualified name of the .proto file that contained the associated /// protobuf element. For example: `"google/protobuf/source_context.proto"`. #[prost(string, tag="1")] - pub file_name: std::string::String, + pub file_name: alloc::string::String, } /// A protocol buffer message type. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Type { /// The fully qualified message name. #[prost(string, tag="1")] - pub name: std::string::String, + pub name: alloc::string::String, /// The list of fields. #[prost(message, repeated, tag="2")] - pub fields: ::std::vec::Vec, + pub fields: ::alloc::vec::Vec, /// The list of types appearing in `oneof` definitions in this type. #[prost(string, repeated, tag="3")] - pub oneofs: ::std::vec::Vec, + pub oneofs: ::alloc::vec::Vec, /// The protocol buffer options. #[prost(message, repeated, tag="4")] - pub options: ::std::vec::Vec