Skip to main content

ToBitStreamWith

Trait ToBitStreamWith 

Source
pub trait ToBitStreamWith<'a> {
    type Context: 'a;
    type Error;

    // Required method
    fn to_writer<W: BitWrite + ?Sized>(
        &self,
        w: &mut W,
        context: &Self::Context,
    ) -> Result<(), Self::Error>
       where Self: Sized;

    // Provided methods
    fn bits<C: Counter>(
        &self,
        context: &Self::Context,
    ) -> Result<C, Self::Error>
       where Self: Sized { ... }
    fn bits_len<C: Counter, E: Endianness>(
        &self,
        context: &Self::Context,
    ) -> Result<C, Self::Error>
       where Self: Sized { ... }
}
Expand description

Implemented by complex types that require additional context to build themselves to a writer

Required Associated Types§

Source

type Context: 'a

Some context to use when writing

Source

type Error

Error generated during building, such as io::Error

Required Methods§

Source

fn to_writer<W: BitWrite + ?Sized>( &self, w: &mut W, context: &Self::Context, ) -> Result<(), Self::Error>
where Self: Sized,

Generate self to writer

Provided Methods§

Source

fn bits<C: Counter>(&self, context: &Self::Context) -> Result<C, Self::Error>
where Self: Sized,

Returns length of self in bits, if possible

Source

fn bits_len<C: Counter, E: Endianness>( &self, context: &Self::Context, ) -> Result<C, Self::Error>
where Self: Sized,

👎Deprecated since 4.0.0:

use of len() is preferred

Returns total length of self, if possible

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§