[−][src]Struct csound::CircularBuffer
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]
T: Copy,
pub fn read(&self, out: &mut [T], items: u32) -> Result<usize, &'static str>[src]
Read from circular buffer.
Arguments
outA mutable slice where the items will be copied.itemsThe 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
outA mutable slice where the items will be copied.itemsThe 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
inputA slice with the date which will be copied into the buffer.itemsThe 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
Auto Trait Implementations
impl<'a, T> Unpin for CircularBuffer<'a, T> where
T: Unpin,
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,
T: RefUnwindSafe,
impl<'a, T> RefUnwindSafe for CircularBuffer<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,