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

Implementations on Foreign Types§

source§

impl Buffer for Sha256

§

type Result = [u8; 32]

source§

fn start() -> Self

source§

fn result(self) -> Self::Result

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.

§

type Result = GenericArray<u8, <CoreWrapper<Sha3_256Core> as OutputSizeUser>::OutputSize>