diff --git a/README.md b/README.md index 8bbb9a3ee..5ed67b516 100644 --- a/README.md +++ b/README.md @@ -332,21 +332,21 @@ and the generated Rust code (`tutorial.rs`): #[derive(Clone, PartialEq, ::prost::Message)] pub struct Person { #[prost(string, tag="1")] - pub name: ::prost::alloc::string::String, + pub name: String, /// Unique ID number for this person. #[prost(int32, tag="2")] pub id: i32, #[prost(string, tag="3")] - pub email: ::prost::alloc::string::String, + pub email: String, #[prost(message, repeated, tag="4")] - pub phones: ::prost::alloc::vec::Vec, + pub phones: Vec, } /// Nested message and enum types in `Person`. pub mod person { #[derive(Clone, PartialEq, ::prost::Message)] pub struct PhoneNumber { #[prost(string, tag="1")] - pub number: ::prost::alloc::string::String, + pub number: String, #[prost(enumeration="PhoneType", tag="2")] pub r#type: i32, } @@ -362,7 +362,7 @@ pub mod person { #[derive(Clone, PartialEq, ::prost::Message)] pub struct AddressBook { #[prost(message, repeated, tag="1")] - pub people: ::prost::alloc::vec::Vec, + pub people: Vec, } ``` diff --git a/conformance/src/main.rs b/conformance/src/main.rs index dd3165cb6..482141281 100644 --- a/conformance/src/main.rs +++ b/conformance/src/main.rs @@ -1,6 +1,5 @@ -use std::io::{self, Read, Write}; - use bytes::{Buf, BufMut}; +use prost::facade::*; use prost::Message; use protobuf::conformance::{ diff --git a/prost-build/src/code_generator.rs b/prost-build/src/code_generator.rs index 12e35c036..4075f78fd 100644 --- a/prost-build/src/code_generator.rs +++ b/prost-build/src/code_generator.rs @@ -1,11 +1,7 @@ -use std::ascii; -use std::borrow::Cow; -use std::collections::{HashMap, HashSet}; -use std::iter; - use itertools::{Either, Itertools}; use log::debug; use multimap::MultiMap; +use prost::facade::*; use prost_types::field_descriptor_proto::{Label, Type}; use prost_types::source_code_info::Location; use prost_types::{ @@ -88,6 +84,8 @@ impl<'a> CodeGenerator<'a> { buf, }; + code_gen.add_prelude(); + debug!( "file: {:?}, package: {:?}", file.name.as_ref().unwrap(), @@ -286,10 +284,6 @@ impl<'a> CodeGenerator<'a> { "const PACKAGE: &'static str = \"{}\";\n", self.package, )); - - let prost_path = self.config.prost_path.as_deref().unwrap_or("::prost"); - let string_path = format!("{prost_path}::alloc::string::String"); - let full_name = format!( "{}{}{}{}{message_name}", self.package.trim_matches('.'), @@ -304,11 +298,11 @@ impl<'a> CodeGenerator<'a> { .map_or("", |name| name.as_str()); self.buf.push_str(&format!( - r#"fn full_name() -> {string_path} {{ "{full_name}".into() }}"#, + r#"fn full_name() -> String {{ "{full_name}".into() }}"#, )); self.buf.push_str(&format!( - r#"fn type_url() -> {string_path} {{ "{domain_name}/{full_name}".into() }}"#, + r#"fn type_url() -> String {{ "{domain_name}/{full_name}".into() }}"#, )); self.depth -= 1; @@ -479,17 +473,13 @@ impl<'a> CodeGenerator<'a> { self.buf.push_str(&to_snake(field.name())); self.buf.push_str(": "); - let prost_path = prost_path(self.config); - if repeated { - self.buf - .push_str(&format!("{}::alloc::vec::Vec<", prost_path)); + self.buf.push_str("Vec<"); } else if optional { self.buf.push_str("::core::option::Option<"); } if boxed { - self.buf - .push_str(&format!("{}::alloc::boxed::Box<", prost_path)); + self.buf.push_str("Box<"); } self.buf.push_str(&ty); if boxed { @@ -644,11 +634,8 @@ impl<'a> CodeGenerator<'a> { ); if boxed { - self.buf.push_str(&format!( - "{}(::prost::alloc::boxed::Box<{}>),\n", - to_upper_camel(field.name()), - ty - )); + self.buf + .push_str(&format!("{}(Box<{}>),\n", to_upper_camel(field.name()), ty)); } else { self.buf .push_str(&format!("{}({}),\n", to_upper_camel(field.name()), ty)); @@ -911,6 +898,7 @@ impl<'a> CodeGenerator<'a> { self.buf.push_str("pub mod "); self.buf.push_str(&to_snake(module)); self.buf.push_str(" {\n"); + self.add_prelude(); self.type_path.push(module.into()); @@ -935,7 +923,7 @@ 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 => format!("{}::alloc::string::String", prost_path(self.config)), + Type::String => "String".to_string(), Type::Bytes => self .config .bytes_type @@ -1056,6 +1044,12 @@ impl<'a> CodeGenerator<'a> { message_name, ) } + + fn add_prelude(&mut self) { + self.buf.push_str("#[allow(unused_imports)]"); + self.buf + .push_str(&format!("use {}::facade::*;", prost_path(self.config))); + } } /// Returns `true` if the repeated field type can be packed. diff --git a/prost-build/src/collections.rs b/prost-build/src/collections.rs index 63be4d627..5a3b3553c 100644 --- a/prost-build/src/collections.rs +++ b/prost-build/src/collections.rs @@ -2,10 +2,11 @@ #[non_exhaustive] #[derive(Default, Clone, Copy, Debug, PartialEq)] pub(crate) enum MapType { + // IMPROVEMENT: place behind std feature flag /// The [`std::collections::HashMap`] type. #[default] HashMap, - /// The [`std::collections::BTreeMap`] type. + /// The [`alloc::collections::BTreeMap`] type. BTreeMap, } @@ -32,8 +33,8 @@ impl MapType { /// The fully-qualified Rust type corresponding to the map type. pub fn rust_type(&self) -> &'static str { match self { - MapType::HashMap => "::std::collections::HashMap", - MapType::BTreeMap => "::prost::alloc::collections::BTreeMap", + MapType::HashMap => "HashMap", + MapType::BTreeMap => "BTreeMap", } } } @@ -50,7 +51,7 @@ impl BytesType { /// The fully-qualified Rust type corresponding to the bytes type. pub fn rust_type(&self) -> &'static str { match self { - BytesType::Vec => "::prost::alloc::vec::Vec", + BytesType::Vec => "Vec", BytesType::Bytes => "::prost::bytes::Bytes", } } diff --git a/prost-build/src/config.rs b/prost-build/src/config.rs index 670c0befe..41a16abe8 100644 --- a/prost-build/src/config.rs +++ b/prost-build/src/config.rs @@ -1,6 +1,3 @@ -use std::collections::HashMap; -use std::default; -use std::env; use std::ffi::{OsStr, OsString}; use std::fmt; use std::fs; @@ -11,6 +8,7 @@ use std::process::Command; use log::debug; use log::trace; +use prost::facade::*; use prost::Message; use prost_types::{FileDescriptorProto, FileDescriptorSet}; diff --git a/prost-build/src/extern_paths.rs b/prost-build/src/extern_paths.rs index 27c8d6d71..1b04cee4d 100644 --- a/prost-build/src/extern_paths.rs +++ b/prost-build/src/extern_paths.rs @@ -1,9 +1,9 @@ -use std::collections::{hash_map, HashMap}; - use itertools::Itertools; use crate::ident::{to_snake, to_upper_camel}; +use prost::facade::*; + fn validate_proto_path(path: &str) -> Result<(), String> { if path.chars().next().map(|c| c != '.').unwrap_or(true) { return Err(format!( @@ -37,7 +37,7 @@ impl ExternPaths { extern_paths.insert(".google.protobuf.BoolValue".to_string(), "bool".to_string())?; extern_paths.insert( ".google.protobuf.BytesValue".to_string(), - "::prost::alloc::vec::Vec".to_string(), + "Vec".to_string(), )?; extern_paths.insert( ".google.protobuf.DoubleValue".to_string(), @@ -49,7 +49,7 @@ impl ExternPaths { extern_paths.insert(".google.protobuf.Int64Value".to_string(), "i64".to_string())?; extern_paths.insert( ".google.protobuf.StringValue".to_string(), - "::prost::alloc::string::String".to_string(), + "String".to_string(), )?; extern_paths.insert( ".google.protobuf.UInt32Value".to_string(), diff --git a/prost-build/src/fixtures/field_attributes/_expected_field_attributes.rs b/prost-build/src/fixtures/field_attributes/_expected_field_attributes.rs index 95fb05d86..3c227c80d 100644 --- a/prost-build/src/fixtures/field_attributes/_expected_field_attributes.rs +++ b/prost-build/src/fixtures/field_attributes/_expected_field_attributes.rs @@ -2,33 +2,32 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Container { - #[prost(oneof="container::Data", tags="1, 2")] + #[prost(oneof = "container::Data", tags = "1, 2")] pub data: ::core::option::Option, } /// Nested message and enum types in `Container`. pub mod container { #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Data { - #[prost(message, tag="1")] - Foo(::prost::alloc::boxed::Box), - #[prost(message, tag="2")] + #[prost(message, tag = "1")] + Foo(Box), + #[prost(message, tag = "2")] Bar(super::Bar), } } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Foo { - #[prost(string, tag="1")] - pub foo: ::prost::alloc::string::String, + #[prost(string, tag = "1")] + pub foo: String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Bar { - #[prost(message, optional, boxed, tag="1")] - pub qux: ::core::option::Option<::prost::alloc::boxed::Box>, + #[prost(message, optional, boxed, tag = "1")] + pub qux: ::core::option::Option>, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct Qux { -} +pub struct Qux {} diff --git a/prost-build/src/fixtures/field_attributes/_expected_field_attributes_formatted.rs b/prost-build/src/fixtures/field_attributes/_expected_field_attributes_formatted.rs index f1eaee751..72e1e9ff8 100644 --- a/prost-build/src/fixtures/field_attributes/_expected_field_attributes_formatted.rs +++ b/prost-build/src/fixtures/field_attributes/_expected_field_attributes_formatted.rs @@ -3,7 +3,7 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct Container { #[prost(oneof = "container::Data", tags = "1, 2")] - pub data: ::core::option::Option, + pub data: Option, } /// Nested message and enum types in `Container`. pub mod container { @@ -11,7 +11,7 @@ pub mod container { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Data { #[prost(message, tag = "1")] - Foo(::prost::alloc::boxed::Box), + Foo(Box), #[prost(message, tag = "2")] Bar(super::Bar), } @@ -20,13 +20,13 @@ pub mod container { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Foo { #[prost(string, tag = "1")] - pub foo: ::prost::alloc::string::String, + pub foo: String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Bar { #[prost(message, optional, boxed, tag = "1")] - pub qux: ::core::option::Option<::prost::alloc::boxed::Box>, + pub qux: Option>, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/prost-build/src/fixtures/helloworld/_expected_helloworld.rs b/prost-build/src/fixtures/helloworld/_expected_helloworld.rs index 401ee90cd..0ddd7f54d 100644 --- a/prost-build/src/fixtures/helloworld/_expected_helloworld.rs +++ b/prost-build/src/fixtures/helloworld/_expected_helloworld.rs @@ -3,15 +3,15 @@ #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Message { - #[prost(string, tag="1")] - pub say: ::prost::alloc::string::String, + #[prost(string, tag = "1")] + pub say: String, } #[derive(derive_builder::Builder)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Response { - #[prost(string, tag="1")] - pub say: ::prost::alloc::string::String, + #[prost(string, tag = "1")] + pub say: String, } #[some_enum_attr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] diff --git a/prost-build/src/fixtures/helloworld/_expected_helloworld_formatted.rs b/prost-build/src/fixtures/helloworld/_expected_helloworld_formatted.rs index 3f688c7e0..0ddd7f54d 100644 --- a/prost-build/src/fixtures/helloworld/_expected_helloworld_formatted.rs +++ b/prost-build/src/fixtures/helloworld/_expected_helloworld_formatted.rs @@ -4,14 +4,14 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct Message { #[prost(string, tag = "1")] - pub say: ::prost::alloc::string::String, + pub say: String, } #[derive(derive_builder::Builder)] #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Response { #[prost(string, tag = "1")] - pub say: ::prost::alloc::string::String, + pub say: String, } #[some_enum_attr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] diff --git a/prost-build/src/lib.rs b/prost-build/src/lib.rs index c979d19cd..4c2214080 100644 --- a/prost-build/src/lib.rs +++ b/prost-build/src/lib.rs @@ -131,9 +131,6 @@ //! //! [`protobuf-src`]: https://docs.rs/protobuf-src -use std::io::Result; -use std::path::Path; - use prost_types::FileDescriptorSet; mod ast; @@ -154,6 +151,8 @@ pub use config::Config; mod module; pub use module::Module; +use prost::facade::*; + /// A service generator takes a service descriptor and generates Rust code. /// /// `ServiceGenerator` can be used to generate application-specific interfaces @@ -241,7 +240,10 @@ pub trait ServiceGenerator { /// [2]: http://doc.crates.io/build-script.html#case-study-code-generation /// [3]: https://developers.google.com/protocol-buffers/docs/proto3#importing-definitions /// [4]: https://developers.google.com/protocol-buffers/docs/proto#packages -pub fn compile_protos(protos: &[impl AsRef], includes: &[impl AsRef]) -> Result<()> { +pub fn compile_protos( + protos: &[impl AsRef], + includes: &[impl AsRef], +) -> io::Result<()> { Config::new().compile_protos(protos, includes) } @@ -267,17 +269,12 @@ pub fn compile_protos(protos: &[impl AsRef], includes: &[impl AsRef] /// prost_build::compile_fds(file_descriptor_set) /// } /// ``` -pub fn compile_fds(fds: FileDescriptorSet) -> Result<()> { +pub fn compile_fds(fds: FileDescriptorSet) -> io::Result<()> { Config::new().compile_fds(fds) } #[cfg(test)] mod tests { - use std::cell::RefCell; - use std::fs::{self, File}; - use std::io::Read; - use std::rc::Rc; - use super::*; /// An example service generator that generates a trait with methods corresponding to the @@ -374,7 +371,7 @@ mod tests { ) .unwrap(); - let state = state.borrow(); + let state = RefCell::borrow(&state); assert_eq!(&state.service_names, &["Greeting", "Farewell"]); assert_eq!(&state.package_names, &["helloworld"]); assert_eq!(state.finalized, 3); diff --git a/prost-build/src/message_graph.rs b/prost-build/src/message_graph.rs index ac0ad1523..9f1d3110e 100644 --- a/prost-build/src/message_graph.rs +++ b/prost-build/src/message_graph.rs @@ -1,11 +1,11 @@ -use std::collections::HashMap; - use petgraph::algo::has_path_connecting; use petgraph::graph::NodeIndex; use petgraph::Graph; use prost_types::{field_descriptor_proto, DescriptorProto, FileDescriptorProto}; +use prost::facade::*; + /// `MessageGraph` builds a graph of messages whose edges correspond to nesting. /// The goal is to recognize when message types are recursively nested, so /// that fields can be boxed when necessary. diff --git a/prost-build/src/module.rs b/prost-build/src/module.rs index 21cab1163..61f567fcf 100644 --- a/prost-build/src/module.rs +++ b/prost-build/src/module.rs @@ -1,5 +1,4 @@ -use std::fmt; -use std::ops::RangeToInclusive; +use prost::facade::*; use crate::ident::to_snake; diff --git a/prost-build/src/path.rs b/prost-build/src/path.rs index f6897005d..10d645d5c 100644 --- a/prost-build/src/path.rs +++ b/prost-build/src/path.rs @@ -1,6 +1,6 @@ //! Utilities for working with Protobuf paths. -use std::iter; +use prost::facade::*; /// Maps a fully-qualified Protobuf path to a value using path matchers. #[derive(Debug, Default)] diff --git a/prost-derive/src/field/map.rs b/prost-derive/src/field/map.rs index 4855cc5c6..7f3a9584a 100644 --- a/prost-derive/src/field/map.rs +++ b/prost-derive/src/field/map.rs @@ -27,13 +27,6 @@ impl MapTy { MapTy::BTreeMap => Ident::new("btree_map", Span::call_site()), } } - - fn lib(&self) -> TokenStream { - match self { - MapTy::HashMap => quote! { std }, - MapTy::BTreeMap => quote! { prost::alloc }, - } - } } fn fake_scalar(ty: scalar::Ty) -> scalar::Field { @@ -307,7 +300,7 @@ impl Field { let key_wrapper = fake_scalar(self.key_ty.clone()).debug(quote!(KeyWrapper)); let key = self.key_ty.rust_type(); let value_wrapper = self.value_ty.debug(); - let libname = self.map_ty.lib(); + let fmt = quote! { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { #key_wrapper @@ -319,6 +312,9 @@ impl Field { builder.finish() } }; + + // FIXME: facade import https://github.com/tokio-rs/prost/issues/939 + match &self.value_ty { ValueTy::Scalar(ty) => { if let scalar::Ty::Bytes(_) = *ty { @@ -334,14 +330,14 @@ impl Field { let value = ty.rust_type(); quote! { - struct #wrapper_name<'a>(&'a ::#libname::collections::#type_name<#key, #value>); + struct #wrapper_name<'a>(&'a ::prost::facade::#type_name<#key, #value>); impl<'a> ::core::fmt::Debug for #wrapper_name<'a> { #fmt } } } ValueTy::Message => quote! { - struct #wrapper_name<'a, V: 'a>(&'a ::#libname::collections::#type_name<#key, V>); + struct #wrapper_name<'a, V: 'a>(&'a ::prost::facade::#type_name<#key, V>); impl<'a, V> ::core::fmt::Debug for #wrapper_name<'a, V> where V: ::core::fmt::Debug + 'a, diff --git a/prost-derive/src/field/scalar.rs b/prost-derive/src/field/scalar.rs index 6be16cd70..4347b01a9 100644 --- a/prost-derive/src/field/scalar.rs +++ b/prost-derive/src/field/scalar.rs @@ -207,7 +207,7 @@ impl Field { match self.kind { Kind::Plain(ref value) | Kind::Required(ref value) => value.owned(), Kind::Optional(_) => quote!(::core::option::Option::None), - Kind::Repeated | Kind::Packed => quote!(::prost::alloc::vec::Vec::new()), + Kind::Repeated | Kind::Packed => quote!(Vec::new()), } } @@ -251,7 +251,7 @@ impl Field { }, Kind::Repeated | Kind::Packed => { quote! { - struct #wrapper_name<'a>(&'a ::prost::alloc::vec::Vec<#inner_ty>); + struct #wrapper_name<'a>(&'a Vec<#inner_ty>); impl<'a> ::core::fmt::Debug for #wrapper_name<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { let mut vec_builder = f.debug_list(); @@ -418,7 +418,7 @@ impl BytesTy { fn rust_type(&self) -> TokenStream { match self { - BytesTy::Vec => quote! { ::prost::alloc::vec::Vec }, + BytesTy::Vec => quote! { Vec }, BytesTy::Bytes => quote! { ::prost::bytes::Bytes }, } } @@ -530,7 +530,7 @@ impl Ty { // TODO: rename to 'owned_type'. pub fn rust_type(&self) -> TokenStream { match self { - Ty::String => quote!(::prost::alloc::string::String), + Ty::String => quote!(String), Ty::Bytes(ty) => ty.rust_type(), _ => self.rust_ref_type(), } @@ -781,7 +781,7 @@ impl DefaultValue { pub fn owned(&self) -> TokenStream { match *self { DefaultValue::String(ref value) if value.is_empty() => { - quote!(::prost::alloc::string::String::new()) + quote!(String::new()) } DefaultValue::String(ref value) => quote!(#value.into()), DefaultValue::Bytes(ref value) if value.is_empty() => { diff --git a/prost-types/Cargo.toml b/prost-types/Cargo.toml index 8c9d455b3..f782733d5 100644 --- a/prost-types/Cargo.toml +++ b/prost-types/Cargo.toml @@ -20,10 +20,10 @@ doctest = false [features] default = ["std"] -std = ["prost/std"] +std = ["prost/std", "proptest/std"] [dependencies] prost = { version = "0.12.4", path = "../prost", default-features = false, features = ["prost-derive"] } [dev-dependencies] -proptest = "1" +proptest = { version = "1", default-features = false, features = ["lazy_static", "regex-syntax"] } diff --git a/prost-types/src/compiler.rs b/prost-types/src/compiler.rs index 0a3b46804..65561be0b 100644 --- a/prost-types/src/compiler.rs +++ b/prost-types/src/compiler.rs @@ -1,5 +1,7 @@ // This file is @generated by prost-build. /// The version number of protocol compiler. +use ::prost::facade::*; + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Version { @@ -12,7 +14,7 @@ pub struct Version { /// 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: ::core::option::Option<::prost::alloc::string::String>, + pub suffix: ::core::option::Option, } /// An encoded CodeGeneratorRequest is written to the plugin's stdin. #[allow(clippy::derive_partial_eq_without_eq)] @@ -22,10 +24,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: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + pub file_to_generate: Vec, /// The generator parameter passed on the command-line. #[prost(string, optional, tag = "2")] - pub parameter: ::core::option::Option<::prost::alloc::string::String>, + 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 +43,7 @@ pub struct CodeGeneratorRequest { /// Type names of fields and extensions in the FileDescriptorProto are always /// fully qualified. #[prost(message, repeated, tag = "15")] - pub proto_file: ::prost::alloc::vec::Vec, + pub proto_file: Vec, /// The version number of protocol compiler. #[prost(message, optional, tag = "3")] pub compiler_version: ::core::option::Option, @@ -59,16 +61,18 @@ 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: ::core::option::Option<::prost::alloc::string::String>, + pub error: ::core::option::Option, /// A bitmask of supported features that the code generator supports. /// This is a bitwise "or" of values from the Feature enum. #[prost(uint64, optional, tag = "2")] pub supported_features: ::core::option::Option, #[prost(message, repeated, tag = "15")] - pub file: ::prost::alloc::vec::Vec, + pub file: Vec, } /// Nested message and enum types in `CodeGeneratorResponse`. pub mod code_generator_response { + use ::prost::facade::*; + /// Represents a single generated file. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -85,7 +89,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: ::core::option::Option<::prost::alloc::string::String>, + 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 @@ -124,10 +128,10 @@ pub mod code_generator_response { /// /// If |insertion_point| is present, |name| must also be present. #[prost(string, optional, tag = "2")] - pub insertion_point: ::core::option::Option<::prost::alloc::string::String>, + pub insertion_point: ::core::option::Option, /// The file contents. #[prost(string, optional, tag = "15")] - pub content: ::core::option::Option<::prost::alloc::string::String>, + pub content: ::core::option::Option, /// Information describing the file content being inserted. If an insertion /// point is used, this information will be appropriately offset and inserted /// into the code generation metadata for the generated files. @@ -135,17 +139,7 @@ pub mod code_generator_response { pub generated_code_info: ::core::option::Option, } /// Sync with code_generator.h. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Feature { None = 0, diff --git a/prost-types/src/datetime.rs b/prost-types/src/datetime.rs index 2435ffe73..3ede20c6d 100644 --- a/prost-types/src/datetime.rs +++ b/prost-types/src/datetime.rs @@ -1,6 +1,5 @@ //! A date/time type which exists primarily to convert [`Timestamp`]s into an RFC 3339 formatted //! string. - use core::fmt; use crate::Duration; @@ -583,9 +582,12 @@ impl From for Timestamp { #[cfg(test)] mod tests { - use super::*; + use alloc::{format, string::ToString}; + use proptest::prelude::*; + use super::*; + #[test] fn test_min_max() { assert_eq!( @@ -604,8 +606,8 @@ mod tests { ); } - #[cfg(feature = "std")] #[test] + #[cfg(feature = "std")] fn test_datetime_from_timestamp() { let case = |expected: &str, secs: i64, nanos: i32| { let timestamp = Timestamp { diff --git a/prost-types/src/duration.rs b/prost-types/src/duration.rs index 600716933..9b9e19b48 100644 --- a/prost-types/src/duration.rs +++ b/prost-types/src/duration.rs @@ -1,5 +1,7 @@ use super::*; +use core::time; + #[cfg(feature = "std")] impl std::hash::Hash for Duration { fn hash(&self, state: &mut H) { diff --git a/prost-types/src/lib.rs b/prost-types/src/lib.rs index 3196f4426..5f3bfab69 100644 --- a/prost-types/src/lib.rs +++ b/prost-types/src/lib.rs @@ -1,5 +1,3 @@ -#![doc(html_root_url = "https://docs.rs/prost-types/0.12.2")] - //! Protocol Buffers well-known types. //! //! Note that the documentation for the types defined in this crate are generated from the Protobuf @@ -12,7 +10,14 @@ //! //! [1]: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf -#![cfg_attr(not(feature = "std"), no_std)] +#![doc(html_root_url = "https://docs.rs/prost-types/0.12.2")] +#![no_std] + +// See: https://github.com/tokio-rs/prost/pull/1047 +#[cfg(any(feature = "std", test))] +extern crate std; + +extern crate alloc; #[rustfmt::skip] pub mod compiler; @@ -20,16 +25,8 @@ mod datetime; #[rustfmt::skip] mod protobuf; -use core::convert::TryFrom; -use core::fmt; -use core::i32; -use core::i64; -use core::str::FromStr; -use core::time; +use prost::facade::*; -use prost::alloc::format; -use prost::alloc::string::String; -use prost::alloc::vec::Vec; use prost::{DecodeError, EncodeError, Message, Name}; pub use protobuf::*; diff --git a/prost-types/src/protobuf.rs b/prost-types/src/protobuf.rs index edc1361be..752355e9a 100644 --- a/prost-types/src/protobuf.rs +++ b/prost-types/src/protobuf.rs @@ -1,11 +1,13 @@ // This file is @generated by prost-build. /// The protocol compiler can output a FileDescriptorSet containing the .proto /// files it parses. +use ::prost::facade::*; + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FileDescriptorSet { #[prost(message, repeated, tag = "1")] - pub file: ::prost::alloc::vec::Vec, + pub file: Vec, } /// Describes a complete .proto file. #[allow(clippy::derive_partial_eq_without_eq)] @@ -13,29 +15,29 @@ pub struct FileDescriptorSet { pub struct FileDescriptorProto { /// file name, relative to root of source tree #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + pub name: ::core::option::Option, /// e.g. "foo", "foo.bar", etc. #[prost(string, optional, tag = "2")] - pub package: ::core::option::Option<::prost::alloc::string::String>, + pub package: ::core::option::Option, /// Names of files imported by this file. #[prost(string, repeated, tag = "3")] - pub dependency: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + pub dependency: Vec, /// Indexes of the public imported files in the dependency list above. #[prost(int32, repeated, packed = "false", tag = "10")] - pub public_dependency: ::prost::alloc::vec::Vec, + pub public_dependency: 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: ::prost::alloc::vec::Vec, + pub weak_dependency: Vec, /// All top-level definitions in this file. #[prost(message, repeated, tag = "4")] - pub message_type: ::prost::alloc::vec::Vec, + pub message_type: Vec, #[prost(message, repeated, tag = "5")] - pub enum_type: ::prost::alloc::vec::Vec, + pub enum_type: Vec, #[prost(message, repeated, tag = "6")] - pub service: ::prost::alloc::vec::Vec, + pub service: Vec, #[prost(message, repeated, tag = "7")] - pub extension: ::prost::alloc::vec::Vec, + pub extension: Vec, #[prost(message, optional, tag = "8")] pub options: ::core::option::Option, /// This field contains optional information about the original source code. @@ -47,34 +49,34 @@ pub struct FileDescriptorProto { /// The syntax of the proto file. /// The supported values are "proto2" and "proto3". #[prost(string, optional, tag = "12")] - pub syntax: ::core::option::Option<::prost::alloc::string::String>, + pub syntax: ::core::option::Option, } /// Describes a message type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DescriptorProto { #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + pub name: ::core::option::Option, #[prost(message, repeated, tag = "2")] - pub field: ::prost::alloc::vec::Vec, + pub field: Vec, #[prost(message, repeated, tag = "6")] - pub extension: ::prost::alloc::vec::Vec, + pub extension: Vec, #[prost(message, repeated, tag = "3")] - pub nested_type: ::prost::alloc::vec::Vec, + pub nested_type: Vec, #[prost(message, repeated, tag = "4")] - pub enum_type: ::prost::alloc::vec::Vec, + pub enum_type: Vec, #[prost(message, repeated, tag = "5")] - pub extension_range: ::prost::alloc::vec::Vec, + pub extension_range: Vec, #[prost(message, repeated, tag = "8")] - pub oneof_decl: ::prost::alloc::vec::Vec, + pub oneof_decl: Vec, #[prost(message, optional, tag = "7")] pub options: ::core::option::Option, #[prost(message, repeated, tag = "9")] - pub reserved_range: ::prost::alloc::vec::Vec, + pub reserved_range: 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: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + pub reserved_name: Vec, } /// Nested message and enum types in `DescriptorProto`. pub mod descriptor_proto { @@ -109,14 +111,14 @@ pub mod descriptor_proto { pub struct ExtensionRangeOptions { /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } /// Describes a field within a message. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FieldDescriptorProto { #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + pub name: ::core::option::Option, #[prost(int32, optional, tag = "3")] pub number: ::core::option::Option, #[prost(enumeration = "field_descriptor_proto::Label", optional, tag = "4")] @@ -131,18 +133,18 @@ pub struct FieldDescriptorProto { /// message are searched, then within the parent, on up to the root /// namespace). #[prost(string, optional, tag = "6")] - pub type_name: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + 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")] @@ -152,7 +154,7 @@ pub struct FieldDescriptorProto { /// 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: ::core::option::Option<::prost::alloc::string::String>, + pub json_name: ::core::option::Option, #[prost(message, optional, tag = "8")] pub options: ::core::option::Option, /// If true, this is a proto3 "optional". When a proto3 field is optional, it @@ -181,17 +183,7 @@ pub struct FieldDescriptorProto { } /// Nested message and enum types in `FieldDescriptorProto`. pub mod field_descriptor_proto { - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Type { /// 0 is reserved for errors. @@ -279,17 +271,7 @@ pub mod field_descriptor_proto { } } } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Label { /// 0 is reserved for errors @@ -325,7 +307,7 @@ pub mod field_descriptor_proto { #[derive(Clone, PartialEq, ::prost::Message)] pub struct OneofDescriptorProto { #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + pub name: ::core::option::Option, #[prost(message, optional, tag = "2")] pub options: ::core::option::Option, } @@ -334,22 +316,20 @@ pub struct OneofDescriptorProto { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EnumDescriptorProto { #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + pub name: ::core::option::Option, #[prost(message, repeated, tag = "2")] - pub value: ::prost::alloc::vec::Vec, + pub value: Vec, #[prost(message, optional, tag = "3")] 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: ::prost::alloc::vec::Vec< - enum_descriptor_proto::EnumReservedRange, - >, + pub reserved_range: 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: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + pub reserved_name: Vec, } /// Nested message and enum types in `EnumDescriptorProto`. pub mod enum_descriptor_proto { @@ -375,7 +355,7 @@ pub mod enum_descriptor_proto { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EnumValueDescriptorProto { #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + pub name: ::core::option::Option, #[prost(int32, optional, tag = "2")] pub number: ::core::option::Option, #[prost(message, optional, tag = "3")] @@ -386,9 +366,9 @@ pub struct EnumValueDescriptorProto { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ServiceDescriptorProto { #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + pub name: ::core::option::Option, #[prost(message, repeated, tag = "2")] - pub method: ::prost::alloc::vec::Vec, + pub method: Vec, #[prost(message, optional, tag = "3")] pub options: ::core::option::Option, } @@ -397,13 +377,13 @@ pub struct ServiceDescriptorProto { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MethodDescriptorProto { #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + pub input_type: ::core::option::Option, #[prost(string, optional, tag = "3")] - pub output_type: ::core::option::Option<::prost::alloc::string::String>, + pub output_type: ::core::option::Option, #[prost(message, optional, tag = "4")] pub options: ::core::option::Option, /// Identifies if client streams multiple client messages @@ -450,14 +430,14 @@ pub struct FileOptions { /// inappropriate because proto packages do not normally start with backwards /// domain names. #[prost(string, optional, tag = "1")] - pub java_package: ::core::option::Option<::prost::alloc::string::String>, + pub java_package: ::core::option::Option, /// Controls the name of the wrapper Java class generated for the .proto file. /// That class will always contain the .proto file's getDescriptor() method as /// well as any top-level extensions defined in the .proto file. /// If java_multiple_files is disabled, then all the other classes from the /// .proto file will be nested inside the single wrapper outer class. #[prost(string, optional, tag = "8")] - pub java_outer_classname: ::core::option::Option<::prost::alloc::string::String>, + pub java_outer_classname: ::core::option::Option, /// If enabled, 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 wrapper class @@ -492,7 +472,7 @@ pub struct FileOptions { /// * 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: ::core::option::Option<::prost::alloc::string::String>, + 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). @@ -524,54 +504,44 @@ pub struct FileOptions { /// 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: ::core::option::Option<::prost::alloc::string::String>, + pub objc_class_prefix: ::core::option::Option, /// Namespace for generated classes; defaults to the package. #[prost(string, optional, tag = "37")] - pub csharp_namespace: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + 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: ::core::option::Option<::prost::alloc::string::String>, + 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: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } /// Nested message and enum types in `FileOptions`. pub mod file_options { /// Generated classes can be optimized for speed or code size. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum OptimizeMode { /// Generate complete code for parsing, serialization, @@ -665,7 +635,7 @@ pub struct MessageOptions { 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: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -746,21 +716,11 @@ pub struct FieldOptions { pub weak: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } /// Nested message and enum types in `FieldOptions`. pub mod field_options { - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum CType { /// Default mode. @@ -790,17 +750,7 @@ pub mod field_options { } } } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum JsType { /// Use the default type. @@ -838,7 +788,7 @@ 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: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -855,7 +805,7 @@ pub struct EnumOptions { pub deprecated: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -868,7 +818,7 @@ pub struct EnumValueOptions { pub deprecated: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -881,7 +831,7 @@ pub struct ServiceOptions { pub deprecated: ::core::option::Option, /// The parser stores options it doesn't recognize here. See above. #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -901,24 +851,14 @@ pub struct MethodOptions { 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: ::prost::alloc::vec::Vec, + pub uninterpreted_option: Vec, } /// Nested message and enum types in `MethodOptions`. pub mod method_options { /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, /// or neither? HTTP based RPC implementation may choose GET verb for safe /// methods, and PUT verb for idempotent methods instead of the default POST. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum IdempotencyLevel { IdempotencyUnknown = 0, @@ -960,11 +900,11 @@ pub mod method_options { #[derive(Clone, PartialEq, ::prost::Message)] pub struct UninterpretedOption { #[prost(message, repeated, tag = "2")] - pub name: ::prost::alloc::vec::Vec, + pub name: 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: ::core::option::Option<::prost::alloc::string::String>, + pub identifier_value: ::core::option::Option, #[prost(uint64, optional, tag = "4")] pub positive_int_value: ::core::option::Option, #[prost(int64, optional, tag = "5")] @@ -972,12 +912,13 @@ pub struct UninterpretedOption { #[prost(double, optional, tag = "6")] pub double_value: ::core::option::Option, #[prost(bytes = "vec", optional, tag = "7")] - pub string_value: ::core::option::Option<::prost::alloc::vec::Vec>, + pub string_value: ::core::option::Option>, #[prost(string, optional, tag = "8")] - pub aggregate_value: ::core::option::Option<::prost::alloc::string::String>, + pub aggregate_value: ::core::option::Option, } /// Nested message and enum types in `UninterpretedOption`. pub mod uninterpreted_option { + use ::prost::facade::*; /// The name of the uninterpreted option. Each string represents a segment in /// a dot-separated name. is_extension is true iff a segment represents an /// extension (denoted with parentheses in options specs in .proto files). @@ -987,7 +928,7 @@ pub mod uninterpreted_option { #[derive(Clone, PartialEq, ::prost::Message)] pub struct NamePart { #[prost(string, required, tag = "1")] - pub name_part: ::prost::alloc::string::String, + pub name_part: String, #[prost(bool, required, tag = "2")] pub is_extension: bool, } @@ -1042,10 +983,12 @@ 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: ::prost::alloc::vec::Vec, + pub location: Vec, } /// Nested message and enum types in `SourceCodeInfo`. pub mod source_code_info { + use ::prost::facade::*; + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Location { @@ -1073,14 +1016,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: ::prost::alloc::vec::Vec, + pub path: 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: ::prost::alloc::vec::Vec, + pub span: 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. @@ -1129,13 +1072,11 @@ pub mod source_code_info { /// /// // ignored detached comments. #[prost(string, optional, tag = "3")] - pub leading_comments: ::core::option::Option<::prost::alloc::string::String>, + pub leading_comments: ::core::option::Option, #[prost(string, optional, tag = "4")] - pub trailing_comments: ::core::option::Option<::prost::alloc::string::String>, + pub trailing_comments: ::core::option::Option, #[prost(string, repeated, tag = "6")] - pub leading_detached_comments: ::prost::alloc::vec::Vec< - ::prost::alloc::string::String, - >, + pub leading_detached_comments: Vec, } } /// Describes the relationship between generated code and its original source @@ -1147,20 +1088,23 @@ 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: ::prost::alloc::vec::Vec, + pub annotation: Vec, } + /// Nested message and enum types in `GeneratedCodeInfo`. pub mod generated_code_info { + use ::prost::facade::*; + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Annotation { /// 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: ::prost::alloc::vec::Vec, + pub path: Vec, /// Identifies the filesystem path to the original source .proto. #[prost(string, optional, tag = "2")] - pub source_file: ::core::option::Option<::prost::alloc::string::String>, + 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")] @@ -1296,10 +1240,10 @@ pub struct Any { /// Schemes other than `http`, `https` (or the empty scheme) might be /// used with implementation specific semantics. #[prost(string, tag = "1")] - pub type_url: ::prost::alloc::string::String, + pub type_url: String, /// Must be a valid serialized protocol buffer of the above specified type. #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, + pub value: Vec, } /// `SourceContext` represents information about the source of a /// protobuf element, like the file in which it is defined. @@ -1309,7 +1253,7 @@ 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: ::prost::alloc::string::String, + pub file_name: String, } /// A protocol buffer message type. #[allow(clippy::derive_partial_eq_without_eq)] @@ -1317,16 +1261,16 @@ pub struct SourceContext { pub struct Type { /// The fully qualified message name. #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, + pub name: String, /// The list of fields. #[prost(message, repeated, tag = "2")] - pub fields: ::prost::alloc::vec::Vec, + pub fields: Vec, /// The list of types appearing in `oneof` definitions in this type. #[prost(string, repeated, tag = "3")] - pub oneofs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + pub oneofs: Vec, /// The protocol buffer options. #[prost(message, repeated, tag = "4")] - pub options: ::prost::alloc::vec::Vec