Trait rotary_core::ExactSizeBuf[][src]

pub trait ExactSizeBuf {
    fn frames(&self) -> usize;
}

Trait used to describe a buffer that knows exactly how many frames it has regardless of if it’s sized or not.

Examples

use rotary::ExactSizeBuf;

fn test<T>(buf: T) where T: ExactSizeBuf {
    assert_eq!(buf.frames(), 4);
}

test(rotary::interleaved![[0i16; 4]; 4]);
test(rotary::sequential![[0i16; 4]; 4]);
test(rotary::dynamic![[0i16; 4]; 4]);
test(rotary::wrap::interleaved([0i16; 16], 4));
test(rotary::wrap::sequential([0i16; 16], 4));

Required methods

fn frames(&self) -> usize[src]

The number of frames in a buffer.

Examples

use rotary::ExactSizeBuf;

fn test<T>(buf: T) where T: ExactSizeBuf {
    assert_eq!(buf.frames(), 4);
}

test(rotary::interleaved![[0i16; 4]; 4]);
test(rotary::sequential![[0i16; 4]; 4]);
test(rotary::dynamic![[0i16; 4]; 4]);
test(rotary::wrap::interleaved([0i16; 16], 4));
test(rotary::wrap::sequential([0i16; 16], 4));
Loading content...

Implementations on Foreign Types

impl<B: ?Sized> ExactSizeBuf for &B where
    B: ExactSizeBuf
[src]

impl<B: ?Sized> ExactSizeBuf for &mut B where
    B: ExactSizeBuf
[src]

Loading content...

Implementors

Loading content...