pub struct SizeWriter {
pub bytes_written: usize,
}Expand description
A writer that counts how many bytes were written. This is useful for e.g. pre-allocating buffers before writing to them.
Fields§
§bytes_written: usizethe amount of bytes that were written so far
Trait Implementations§
Source§impl Default for SizeWriter
impl Default for SizeWriter
Source§fn default() -> SizeWriter
fn default() -> SizeWriter
Returns the “default value” for a type. Read more
Source§impl Writer for SizeWriter
impl Writer for SizeWriter
Source§fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError>
fn write(&mut self, bytes: &[u8]) -> Result<(), EncodeError>
Write
bytes to the underlying writer. Exactly bytes.len() bytes must be written, or else an error should be returned. Read moreSource§fn write_u8(&mut self, _: u8) -> Result<(), EncodeError>
fn write_u8(&mut self, _: u8) -> Result<(), EncodeError>
Write a single byte to the underlying writer. Read more
Source§fn write_u16(&mut self, _: u16) -> Result<(), EncodeError>
fn write_u16(&mut self, _: u16) -> Result<(), EncodeError>
Write a
u16 to the underlying writer. Read moreSource§fn write_u32(&mut self, _: u32) -> Result<(), EncodeError>
fn write_u32(&mut self, _: u32) -> Result<(), EncodeError>
Write a
u32 to the underlying writer. Read moreSource§fn write_u64(&mut self, _: u64) -> Result<(), EncodeError>
fn write_u64(&mut self, _: u64) -> Result<(), EncodeError>
Write a
u64 to the underlying writer. Read moreSource§fn write_u128(&mut self, _: u128) -> Result<(), EncodeError>
fn write_u128(&mut self, _: u128) -> Result<(), EncodeError>
Write a
u128 to the underlying writer. Read moreAuto Trait Implementations§
impl Freeze for SizeWriter
impl RefUnwindSafe for SizeWriter
impl Send for SizeWriter
impl Sync for SizeWriter
impl Unpin for SizeWriter
impl UnsafeUnpin for SizeWriter
impl UnwindSafe for SizeWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more