Trait bee_common::packable::Packable [−][src]
A trait to pack and unpack types to and from bytes.
Associated Types
Loading content...Required methods
fn packed_len(&self) -> usize[src]
Returns the length of the packed bytes.
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
Packs the instance to bytes and writes them to the passed writer.
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
Reads bytes from the passed reader and unpacks them into an instance.
Provided methods
fn pack_new(&self) -> Vec<u8>ⓘ[src]
Packs the instance to bytes and writes them to a newly allocated vector.
fn unpack<R: Read + ?Sized>(reader: &mut R) -> Result<Self, Self::Error> where
Self: Sized, [src]
Self: Sized,
Reads bytes from the passed reader and unpacks them into an instance. Applies syntactic checks.
fn unpack_unchecked<R: Read + ?Sized>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
Reads bytes from the passed reader and unpacks them into an instance. Doesn’t apply syntactic checks.
Implementations on Foreign Types
impl<const N: usize> Packable for [u8; N][src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for bool[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl<P> Packable for Vec<P> where
P: Packable,
P::Error: From<Error>, [src]
P: Packable,
P::Error: From<Error>,
type Error = P::Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl<P: Packable> Packable for Option<P>[src]
type Error = OptionError<P::Error>
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for i8[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for u8[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for i16[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for u16[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for i32[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for u32[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for i64[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for u64[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for i128[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,
impl Packable for u128[src]
type Error = Error
fn packed_len(&self) -> usize[src]
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>[src]
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized, [src]
reader: &mut R
) -> Result<Self, Self::Error> where
Self: Sized,