Skip to main content

RtQueue

Struct RtQueue 

Source
pub struct RtQueue<T>
where T: Copy,
{ /* private fields */ }
Expand description

Главная RT-safe очередь

§Пример

use rill_core::queues::RtQueue;

// Создаём очередь для команд
let queue = RtQueue::<i32>::new(1024);

// Поток управления (soft RT)
queue.push(42).unwrap();

// Аудиопоток (hard RT)
if let Some(cmd) = queue.pop() {
    println!("Got command: {}", cmd);
}

Implementations§

Source§

impl<T> RtQueue<T>
where T: Copy + Default + Send + 'static,

Source

pub fn new(capacity: usize) -> RtQueue<T>

Создать новую очередь с фиксированным размером

Source

pub fn new_spsc() -> RtQueue<T>

Создать очередь для одного производителя

Source

pub fn new_mpsc(capacity: usize) -> RtQueue<T>

Создать очередь для многих производителей

Source

pub fn push(&self, value: T) -> Result<(), QueueError>

Добавить элемент (из потока управления)

Source

pub fn pop(&self) -> Option<T>

Извлечь элемент (из аудиопотока)

Source

pub fn len(&self) -> usize

Текущий размер

Source

pub fn capacity(&self) -> usize

Вместимость

Source

pub fn is_empty(&self) -> bool

Проверить, пуста ли очередь

Source

pub fn stats(&self) -> QueueStatsSnapshot

Получить статистику

Trait Implementations§

Source§

impl<T> Clone for RtQueue<T>
where T: Copy,

Source§

fn clone(&self) -> RtQueue<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Send for RtQueue<T>
where T: Copy + Send,

Source§

impl<T> Sync for RtQueue<T>
where T: Copy + Sync,

Auto Trait Implementations§

§

impl<T> !Freeze for RtQueue<T>

§

impl<T> !RefUnwindSafe for RtQueue<T>

§

impl<T> Unpin for RtQueue<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for RtQueue<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for RtQueue<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V