protobuf/
lib.rs

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 generate 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
33pub use crate::coded_input_stream::CodedInputStream;
34pub use crate::coded_output_stream::CodedOutputStream;
35pub use crate::enum_full::EnumFull;
36pub use crate::enum_or_unknown::EnumOrUnknown;
37pub use crate::enums::Enum;
38pub use crate::message::Message;
39pub use crate::message_dyn::MessageDyn;
40pub use crate::message_field::MessageField;
41pub use crate::message_full::MessageFull;
42pub use crate::oneof::Oneof;
43pub use crate::oneof_full::OneofFull;
44pub use crate::special::SpecialFields;
45pub use crate::unknown::UnknownFields;
46pub use crate::unknown::UnknownFieldsIter;
47pub use crate::unknown::UnknownValue;
48pub use crate::unknown::UnknownValueRef;
49pub(crate) mod wire_format;
50#[cfg(feature = "bytes")]
51pub use crate::chars::Chars;
52pub use crate::error::Error;
53pub use crate::error::Result;
54
55// generated
56pub mod descriptor;
57pub mod plugin;
58pub mod rustproto;
59
60mod byteorder;
61mod coded_input_stream;
62mod coded_output_stream;
63mod enum_full;
64mod enum_or_unknown;
65mod enums;
66mod error;
67pub mod ext;
68mod lazy;
69mod message;
70mod message_dyn;
71mod message_field;
72mod message_full;
73mod oneof;
74mod oneof_full;
75mod owning_ref;
76pub mod reflect;
77pub mod rt;
78pub mod text_format;
79pub mod well_known_types;
80mod well_known_types_util;
81
82// used by test
83#[cfg(test)]
84#[path = "../../test-crates/protobuf-test-common/src/hex.rs"]
85mod hex;
86
87mod cached_size;
88mod chars;
89mod fixed;
90mod special;
91mod unknown;
92mod varint;
93mod zigzag;
94
95mod misc;
96
97// This does not work: https://github.com/rust-lang/rust/issues/67295
98#[cfg(doctest)]
99mod doctest_pb;
100
101/// This symbol is in generated `version.rs`, include here for IDE
102#[cfg(never)]
103pub const VERSION: &str = "";
104/// This symbol is in generated `version.rs`, include here for IDE
105#[cfg(never)]
106#[doc(hidden)]
107pub const VERSION_IDENT: &str = "";
108include!(concat!(env!("OUT_DIR"), "/version.rs"));