Trait bee_common::packable::Packable[][src]

pub trait Packable {
    type Error: Debug;
    fn packed_len(&self) -> usize;
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>;
fn unpack_inner<R: Read + ?Sized, const CHECK: bool>(
        reader: &mut R
    ) -> Result<Self, Self::Error>
    where
        Self: Sized
; fn pack_new(&self) -> Vec<u8>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
{ ... }
fn unpack<R: Read + ?Sized>(reader: &mut R) -> Result<Self, Self::Error>
    where
        Self: Sized
, { ... }
fn unpack_unchecked<R: Read + ?Sized>(
        reader: &mut R
    ) -> Result<Self, Self::Error>
    where
        Self: Sized
, { ... } }

A trait to pack and unpack types to and from bytes.

Associated Types

type Error: Debug[src]

Associated error type.

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]

Reads bytes from the passed reader and unpacks them into an instance.

Loading content...

Provided methods

fn pack_new(&self) -> Vec<u8>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[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]

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]

Reads bytes from the passed reader and unpacks them into an instance. Doesn’t apply syntactic checks.

Loading content...

Implementations on Foreign Types

impl<const N: usize> Packable for [u8; N][src]

type Error = Error

impl Packable for bool[src]

type Error = Error

impl<P> Packable for Vec<P> where
    P: Packable,
    P::Error: From<Error>, 
[src]

type Error = P::Error

impl<P: Packable> Packable for Option<P>[src]

type Error = OptionError<P::Error>

impl Packable for i8[src]

type Error = Error

impl Packable for u8[src]

type Error = Error

impl Packable for i16[src]

type Error = Error

impl Packable for u16[src]

type Error = Error

impl Packable for i32[src]

type Error = Error

impl Packable for u32[src]

type Error = Error

impl Packable for i64[src]

type Error = Error

impl Packable for u64[src]

type Error = Error

impl Packable for i128[src]

type Error = Error

impl Packable for u128[src]

type Error = Error

Loading content...

Implementors

Loading content...