Trait I2s

Source
pub trait I2s<W> {
    type Error: Debug;

    // Required methods
    fn read<'w>(
        &mut self,
        left_words: &'w mut [W],
        right_words: &'w mut [W],
    ) -> Result<(), Self::Error>;
    fn write<'w>(
        &mut self,
        left_words: &'w [W],
        right_words: &'w [W],
    ) -> Result<(), Self::Error>;
    fn write_iter<LW, RW>(
        &mut self,
        left_words: LW,
        right_words: RW,
    ) -> Result<(), Self::Error>
       where LW: IntoIterator<Item = W>,
             RW: IntoIterator<Item = W>;
}
Expand description

Blocking I2S trait

Required Associated Types§

Source

type Error: Debug

Error type

Required Methods§

Source

fn read<'w>( &mut self, left_words: &'w mut [W], right_words: &'w mut [W], ) -> Result<(), Self::Error>

Reads enough bytes to fill left_words and right_words.

It is allowed for left_words and right_words to have different lengths. The read runs for max(left_words.len(), right_words.len()) words. Incoming words after the shorter buffer has been filled will be discarded.

Source

fn write<'w>( &mut self, left_words: &'w [W], right_words: &'w [W], ) -> Result<(), Self::Error>

Sends left_words and right_words.

It is allowed for left_words and right_words to have different lengths. The write runs for max(left_words.len(), right_words.len()) words. The value of words sent for the shorter channel after its buffer has been sent is implementation-defined, typically 0x00, 0xFF, or configurable.

Source

fn write_iter<LW, RW>( &mut self, left_words: LW, right_words: RW, ) -> Result<(), Self::Error>
where LW: IntoIterator<Item = W>, RW: IntoIterator<Item = W>,

Sends left_words and right_words getting the data from iterators.

It is allowed for left_words and right_words to have different lengths. The write runs for max(left_words.len(), right_words.len()) words. The value of words sent for the shorter channel after its buffer has been sent is implementation-defined, typically 0x00, 0xFF, or configurable.

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.

Implementors§