TODO pick different name because it aliases with [`crate::buffer::Buffer`].
| 6 | |
| 7 | /// TODO pick different name because it aliases with [`crate::buffer::Buffer`]. |
| 8 | pub trait Buffer { |
| 9 | /// Convenience function for `collect_into`. |
| 10 | fn collect(&mut self) -> Vec<u8> { |
| 11 | let mut vec = vec![]; |
| 12 | self.collect_into(&mut vec); |
| 13 | vec |
| 14 | } |
| 15 | |
| 16 | /// Collects the buffer into a single `Vec<u8>`. This clears the buffer. |
| 17 | fn collect_into(&mut self, out: &mut Vec<u8>); |
| 18 | |
| 19 | /// Reserves space for `additional` calls to `self.encode()`. Takes a [`NonZeroUsize`] to avoid |
| 20 | /// useless calls. |
| 21 | fn reserve(&mut self, additional: NonZeroUsize); |
| 22 | } |
| 23 | |
| 24 | /// Iterators passed to [`Encoder::encode_vectored`] must have length <= this. |
| 25 | pub const MAX_VECTORED_CHUNK: usize = 64; |
nothing calls this directly
no outgoing calls
no test coverage detected