[][src]Struct csound::CircularBuffer

pub struct CircularBuffer<'a, T: 'a + Copy> { /* fields omitted */ }

Csound's Circular Buffer object. This struct wraps a *mut T pointer to a circular buffer allocated by csound. This Circular buffer won't outlive the csound instance that allocated the buffer.

Methods

impl<'a, T> CircularBuffer<'a, T> where
    T: Copy
[src]

pub fn read(&self, out: &mut [T], items: u32) -> Result<usize, &'static str>[src]

Read from circular buffer.

Arguments

  • out A mutable slice where the items will be copied.
  • items The number of elements to read and remove from the buffer.

Returns

The number of items read (0 <= n <= items). or an Error if the output buffer doesn't have enough capacity.

pub fn peek(&self, out: &mut [T], items: u32) -> Result<usize, &'static str>[src]

Read from circular buffer without removing them from the buffer.

Arguments

  • out A mutable slice where the items will be copied.
  • items The number of elements to peek from the buffer.

Returns

The actual number of items read (0 <= n <= items), or an error if the number of items to read/write exceeds the buffer's capacity.

pub fn write(&self, input: &[T], items: u32) -> Result<usize, &'static str>[src]

Write to the circular buffer.

Arguments

  • input A slice with the date which will be copied into the buffer.
  • items The number of elements to wrtie into the buffer.

Returns

The actual number of items written *(0 <= n <= items)**, or an error if the number of items to read/write exceeds the buffer's capacity.

pub fn flush(&self)[src]

Empty circular buffer of any remaining data. This function should only be used if there is no reader actively getting data from the buffer.

Trait Implementations

impl<'a, T> Drop for CircularBuffer<'a, T> where
    T: Copy
[src]

Auto Trait Implementations

impl<'a, T> Unpin for CircularBuffer<'a, T> where
    T: Unpin

impl<'a, T> !Sync for CircularBuffer<'a, T>

impl<'a, T> !Send for CircularBuffer<'a, T>

impl<'a, T> UnwindSafe for CircularBuffer<'a, T> where
    T: RefUnwindSafe

impl<'a, T> RefUnwindSafe for CircularBuffer<'a, T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]