pub struct Sized<T, S, F>(pub F, pub T)
where
T: WriteInto,
S: WriteInto,
F: FnOnce(usize) -> S;
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§
Source§impl<T, S, F> WriteInto for &Sized<T, S, F>
Returns how many bytes was taken by the representation of T
.
impl<T, S, F> WriteInto for &Sized<T, S, F>
Returns how many bytes was taken by the representation of T
.
Auto Trait Implementations§
impl<T, S, F> Freeze for Sized<T, S, F>
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>
impl<T, S, F> Sync for Sized<T, S, F>
impl<T, S, F> Unpin for Sized<T, S, F>
impl<T, S, F> UnwindSafe for Sized<T, S, F>where
F: UnwindSafe,
T: UnwindSafe,
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