pub struct SliceWrite<'a> { /* private fields */ }
Expand description
Implements Write
for mutable byte slices (&mut [u8]
).
Returns an error if the value to serialize is too large to fit in the slice.
Implementations§
Source§impl<'a> SliceWrite<'a>
impl<'a> SliceWrite<'a>
Sourcepub fn new(slice: &'a mut [u8]) -> SliceWrite<'a>
pub fn new(slice: &'a mut [u8]) -> SliceWrite<'a>
Wraps a mutable slice so it can be used as a Write
.
Sourcepub fn bytes_written(&self) -> usize
pub fn bytes_written(&self) -> usize
Returns the number of bytes written to the underlying slice.
Sourcepub fn into_inner(self) -> &'a mut [u8]
pub fn into_inner(self) -> &'a mut [u8]
Returns the underlying slice.
Trait Implementations§
Source§impl<'a> Debug for SliceWrite<'a>
impl<'a> Debug for SliceWrite<'a>
Auto Trait Implementations§
impl<'a> Freeze for SliceWrite<'a>
impl<'a> RefUnwindSafe for SliceWrite<'a>
impl<'a> Send for SliceWrite<'a>
impl<'a> Sync for SliceWrite<'a>
impl<'a> Unpin for SliceWrite<'a>
impl<'a> !UnwindSafe for SliceWrite<'a>
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 12 bytes