Buffer

Trait Buffer 

Source
pub trait Buffer: Sized + WriteBytesExt {
    type Result;

    // Required methods
    fn start() -> Self;
    fn result(self) -> Self::Result;

    // Provided method
    fn start_hint(_l: usize) -> Self { ... }
}
Expand description

Trait for writers which will not fail in normal operation with small amounts of data, e.g., Vec<u8>. Moreover having a special trait allows us to implement it for other types, such as the SHA Digest.

Required Associated Types§

Required Methods§

Source

fn start() -> Self

Source

fn result(self) -> Self::Result

Provided Methods§

Source

fn start_hint(_l: usize) -> Self

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.

Implementations on Foreign Types§

Source§

impl Buffer for Vec<u8>

Implementors§

Source§

impl Buffer for RandomOracle

This implementation allows the use of a random oracle without intermediate allocations of byte buffers.