Trait Pack

Source
pub trait Pack<Out: Write> {
    // Required method
    fn pack(&self, out: &mut Out) -> Result<usize>;
}
Expand description

Basic packing trait.

This trait is used to implement XDR packing any Rust type into a Write stream. It returns the number of bytes the encoding took.

This crate provides a number of implementations for all the basic XDR types, and generated code will generally compose them to pack structures, unions, etc.

Streams generated by Pack can be consumed by Unpack.

Required Methods§

Source

fn pack(&self, out: &mut Out) -> Result<usize>

Implementations on Foreign Types§

Source§

impl<'a, Out: Write, T> Pack<Out> for Cow<'a, T>
where T: 'a + Pack<Out> + ToOwned<Owned = T>,

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for bool

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for f32

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for f64

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for i32

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for i64

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for str

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for u32

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for u64

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for ()

Source§

fn pack(&self, _out: &mut Out) -> Result<usize>

Source§

impl<Out: Write> Pack<Out> for usize

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write, T: Pack<Out>> Pack<Out> for Option<T>

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write, T: Pack<Out>> Pack<Out> for [T]

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write, T: Pack<Out>> Pack<Out> for Box<T>

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Source§

impl<Out: Write, T: Pack<Out>> Pack<Out> for Vec<T>

Source§

fn pack(&self, out: &mut Out) -> Result<usize>

Implementors§

Source§

impl<'a, Out: Write> Pack<Out> for Opaque<'a>