Skip to main content

FromBytes

Trait FromBytes 

Source
pub trait FromBytes<L>: Sized {
    type Error;

    // Required method
    fn from_bytes<B: ByteOrder>(
        bytes: &[u8],
        channels: usize,
    ) -> Result<Self, Self::Error>;
}
Expand description

Decodes a buffer from raw little- or big-endian bytes.

L is the BufferLayout the decoded samples are arranged in.

Required Associated Types§

Source

type Error

The error type produced by a failed conversion.

Required Methods§

Source

fn from_bytes<B: ByteOrder>( bytes: &[u8], channels: usize, ) -> Result<Self, Self::Error>

Decodes channels channels of samples from bytes, reading in byte order B.

§Errors

Fails if bytes is too short for a whole number of frames.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§