Skip to main content

ToByteBufferRef

Trait ToByteBufferRef 

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

    // Required methods
    fn bytes_len(&self);
    fn to_bytes<B: ByteOrder>(
        &self,
        bytes: &mut [u8],
        channels: usize,
    ) -> Result<usize, Self::Error>;
}
Expand description

Encodes a buffer into raw bytes in a caller-chosen endianness.

Required Associated Types§

Source

type Error

The error type produced by a failed conversion.

Required Methods§

Source

fn bytes_len(&self)

The number of bytes Self::to_bytes will write.

Source

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

Encodes the buffer into bytes in byte order B, returning the bytes written.

§Errors

Fails if bytes is too short.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§