pub struct Lengthed<T>(pub T);
Expand description
An helper to prefix a serializable value with it’s size
.
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T> BinRead for Lengthed<T>where
T: BinRead,
impl<T> BinRead for Lengthed<T>where
T: BinRead,
Source§fn read_options<R: Read + Seek>(
reader: &mut R,
endian: Endian,
args: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( reader: &mut R, endian: Endian, args: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
Read
T
from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self
from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self
from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl<T> BinWrite for Lengthed<T>where
T: BinWrite,
impl<T> BinWrite for Lengthed<T>where
T: BinWrite,
Source§fn write_options<W: Write + Seek>(
&self,
writer: &mut W,
endian: Endian,
args: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, writer: &mut W, endian: Endian, args: Self::Args<'_>, ) -> BinResult<()>
Source§fn write<W>(&self, writer: &mut W) -> Result<(), Error>
fn write<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self
to the writer using default arguments. Read moreSource§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self
to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self
to the writer assuming little-endian byte order. Read moreSource§fn write_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Write
Self
to the writer using the given arguments. Read moreSource§impl<T> ReadEndian for Lengthed<T>where
T: ReadEndian,
impl<T> ReadEndian for Lengthed<T>where
T: ReadEndian,
Source§const ENDIAN: EndianKind = T::ENDIAN
const ENDIAN: EndianKind = T::ENDIAN
The endianness of the type.
Source§impl<T> WriteEndian for Lengthed<T>where
T: WriteEndian,
impl<T> WriteEndian for Lengthed<T>where
T: WriteEndian,
Source§const ENDIAN: EndianKind = T::ENDIAN
const ENDIAN: EndianKind = T::ENDIAN
The endianness of the type.
impl<T: Copy> Copy for Lengthed<T>
impl<T: Eq> Eq for Lengthed<T>
impl<T> StructuralPartialEq for Lengthed<T>
Auto Trait Implementations§
impl<T> Freeze for Lengthed<T>where
T: Freeze,
impl<T> RefUnwindSafe for Lengthed<T>where
T: RefUnwindSafe,
impl<T> Send for Lengthed<T>where
T: Send,
impl<T> Sync for Lengthed<T>where
T: Sync,
impl<T> Unpin for Lengthed<T>where
T: Unpin,
impl<T> UnwindSafe for Lengthed<T>where
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