1 //! # Library to read and write protocol buffers data 2 //! 3 //! ## Features 4 //! 5 //! This crate has one feature, which is `with-bytes`. 6 //! 7 //! `with-bytes` enables `protobuf` crate support for 8 //! [`bytes` crate](https://github.com/tokio-rs/bytes): 9 //! when parsing bytes or strings from `bytes::Bytes`, 10 //! `protobuf` will be able to reference the input instead of allocating subarrays. 11 //! 12 //! Note, codegen also need to be instructed to generate `Bytes` or `Chars` for 13 //! `bytes` or `string` protobuf types instead of default `Vec<u8>` or `String`, 14 //! just enabling option on this crate is not enough. 15 //! 16 //! See `Customize` struct in [`protobuf-codegen` crate](https://docs.rs/protobuf-codegen). 17 //! 18 //! ## Accompanying crates 19 //! 20 //! * [`protobuf-json-mapping`](https://docs.rs/protobuf-json-mapping) 21 //! implements JSON parsing and serialization for protobuf messages. 22 //! * [`protobuf-codegen`](https://docs.rs/protobuf-codegen) 23 //! can be used to rust code from `.proto` crates. 24 //! * [`protoc-bin-vendored`](https://docs.rs/protoc-bin-vendored) 25 //! contains `protoc` command packed into the crate. 26 //! * [`protobuf-parse`](https://docs.rs/protobuf-parse) contains 27 //! `.proto` file parser. Rarely need to be used directly, 28 //! but can be used for mechanical processing of `.proto` files. 29 30 #![deny(missing_docs)] 31 #![deny(rustdoc::broken_intra_doc_links)] 32 33 pub use crate::coded_input_stream::CodedInputStream; 34 pub use crate::coded_output_stream::CodedOutputStream; 35 pub use crate::enum_full::EnumFull; 36 pub use crate::enum_or_unknown::EnumOrUnknown; 37 pub use crate::enums::Enum; 38 pub use crate::message::Message; 39 pub use crate::message_dyn::MessageDyn; 40 pub use crate::message_field::MessageField; 41 pub use crate::message_full::MessageFull; 42 pub use crate::oneof::Oneof; 43 pub use crate::oneof_full::OneofFull; 44 pub use crate::special::SpecialFields; 45 pub use crate::unknown::UnknownFields; 46 pub use crate::unknown::UnknownFieldsIter; 47 pub use crate::unknown::UnknownValue; 48 pub use crate::unknown::UnknownValueRef; 49 pub(crate) mod wire_format; 50 #[cfg(feature = "bytes")] 51 pub use crate::chars::Chars; 52 pub use crate::error::Error; 53 pub use crate::error::Result; 54 55 // generated 56 pub mod descriptor; 57 pub mod plugin; 58 pub mod rustproto; 59 60 mod byteorder; 61 mod coded_input_stream; 62 mod coded_output_stream; 63 mod enum_full; 64 mod enum_or_unknown; 65 mod enums; 66 mod error; 67 pub mod ext; 68 mod lazy; 69 mod message; 70 mod message_dyn; 71 mod message_field; 72 mod message_full; 73 mod oneof; 74 mod oneof_full; 75 mod owning_ref; 76 pub mod reflect; 77 pub mod rt; 78 pub mod text_format; 79 pub mod well_known_types; 80 mod well_known_types_util; 81 82 // used by test 83 #[cfg(test)] 84 #[path = "../../test-crates/protobuf-test-common/src/hex.rs"] 85 mod hex; 86 87 mod cached_size; 88 mod chars; 89 mod fixed; 90 mod special; 91 mod unknown; 92 mod varint; 93 mod zigzag; 94 95 mod misc; 96 97 // This does not work: https://github.com/rust-lang/rust/issues/67295 98 #[cfg(doctest)] 99 mod doctest_pb; 100 101 /// This symbol is in generated `version.rs`, include here for IDE 102 #[cfg(never)] 103 pub const VERSION: &str = ""; 104 /// This symbol is in generated `version.rs`, include here for IDE 105 #[cfg(never)] 106 #[doc(hidden)] 107 pub const VERSION_IDENT: &str = ""; 108 include!(concat!(env!("OUT_DIR"), "/version.rs")); 109