|
33 | 33 | //! # Ok(()) }
|
34 | 34 | //! ```
|
35 | 35 | //!
|
| 36 | +//! Serialization often happens one byte at a time, so a buffered writer |
| 37 | +//! should probably be used. |
| 38 | +//! |
36 | 39 | //! There is no serializer for Profile. It would require borrowing a lot of
|
37 | 40 | //! data, which becomes unwieldy. It also isn't very compatible with writing
|
38 | 41 | //! a streaming serializer to lower peak memory usage.
|
@@ -85,6 +88,9 @@ pub trait Value {
|
85 | 88 | fn proto_len(&self) -> u64;
|
86 | 89 |
|
87 | 90 | /// Encode the value to the in-wire protobuf format.
|
| 91 | + /// |
| 92 | + /// Serialization often happens one byte at a time, so a buffered writer |
| 93 | + /// should probably be used. |
88 | 94 | fn encode<W: Write>(&self, writer: &mut W) -> io::Result<()>;
|
89 | 95 |
|
90 | 96 | /// Create a Pair with the given field. The wire type will be added
|
@@ -124,6 +130,9 @@ impl<V: Value> Pair<V> {
|
124 | 130 |
|
125 | 131 | /// Encodes the pair into protobuf, without the zero-size optimization.
|
126 | 132 | ///
|
| 133 | + /// Serialization often happens one byte at a time, so a buffered writer |
| 134 | + /// should probably be used. |
| 135 | + /// |
127 | 136 | /// # Examples
|
128 | 137 | ///
|
129 | 138 | /// Given a message like:
|
@@ -186,6 +195,9 @@ impl<V: Value> WithZeroOptimization<V> {
|
186 | 195 | /// doesn't require fields with values of zero to be present, so to save
|
187 | 196 | /// space, they can be omitted them altogether.
|
188 | 197 | ///
|
| 198 | + /// Serialization often happens one byte at a time, so a buffered writer |
| 199 | + /// should probably be used. |
| 200 | + /// |
189 | 201 | /// # Examples
|
190 | 202 | ///
|
191 | 203 | /// Label is a great message to demonstrate how the optimization is useful
|
|
0 commit comments