Struct write_into::Sized
source · [−]Expand description
Used to write values prepended with size of their representation.
Example
use write_into::{Sized, Plain, Uleb128, write_into};
let mut buffer = Vec::new();
let written = write_into(&mut buffer, Sized(Uleb128, Plain("Hello, Sailor!"))).unwrap();
assert_eq!(written, 14);
assert_eq!(&buffer, b"\x0EHello, Sailor!");
Tuple Fields
0: F
1: T
Trait Implementations
sourceimpl<T, S, F> WriteInto for Sized<T, S, F> where
T: WriteInto,
S: WriteInto,
F: FnOnce(usize) -> S,
impl<T, S, F> WriteInto for Sized<T, S, F> where
T: WriteInto,
S: WriteInto,
F: FnOnce(usize) -> S,
Returns how many bytes was taken by the representation of T
.
type Output = usize
type Output = usize
Result of WriteInto::write_into
function (e.g. ()
or usize
).
sourcefn write_into(self, sink: &mut impl Write) -> Result<Self::Output>
fn write_into(self, sink: &mut impl Write) -> Result<Self::Output>
Writes value into I/O sink.
sourceimpl<T, S, F> WriteInto for &Sized<T, S, F> where
T: Copy + WriteInto,
S: WriteInto,
F: Copy + FnOnce(usize) -> S,
impl<T, S, F> WriteInto for &Sized<T, S, F> where
T: Copy + WriteInto,
S: WriteInto,
F: Copy + FnOnce(usize) -> S,
Returns how many bytes was taken by the representation of T
.
type Output = usize
type Output = usize
Result of WriteInto::write_into
function (e.g. ()
or usize
).
sourcefn write_into(self, sink: &mut impl Write) -> Result<Self::Output>
fn write_into(self, sink: &mut impl Write) -> Result<Self::Output>
Writes value into I/O sink.
Auto Trait Implementations
impl<T, S, F> RefUnwindSafe for Sized<T, S, F> where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S, F> Send for Sized<T, S, F> where
F: Send,
T: Send,
impl<T, S, F> Sync for Sized<T, S, F> where
F: Sync,
T: Sync,
impl<T, S, F> Unpin for Sized<T, S, F> where
F: Unpin,
T: Unpin,
impl<T, S, F> UnwindSafe for Sized<T, S, F> where
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more