pub trait ToBits {
type Symbol;
// Required method
fn to_bits<F, E>(value: Self::Symbol, write: F) -> Result<(), E>
where F: FnMut(bool) -> Result<(), E>;
}
Expand description
For building individual bits from a final value
Though similar to the crate::write::ToBitStream
trait,
this is intended to generate a stream of bits from short symbols
while ToBitStream
is meant for writing larger structs to
a whole writer.
For example, one might have several ToBits
implementations
in a single program that all write i32
symbols to bits,
but implementing ToBitStream
multiple times for i32
isn’t possible (or practical).
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.