pub struct CommandQueue<T> { /* private fields */ }Expand description
Non-blocking bounded command queue.
Provides safe, lock-free transfer of commands from the control thread to the audio signal thread via a bounded crossbeam channel.
§Example
use rill_core::queues::CommandQueue;
let queue = CommandQueue::<i32>::new("test", 16);
queue.send(42).unwrap();
assert_eq!(queue.try_recv(), Ok(42));Implementations§
Source§impl<T: Send + 'static> CommandQueue<T>
impl<T: Send + 'static> CommandQueue<T>
Sourcepub fn new(name: &str, capacity: usize) -> Self
pub fn new(name: &str, capacity: usize) -> Self
Create a new bounded queue with the given capacity.
Sourcepub fn send(&self, value: T) -> Result<(), QueueError>
pub fn send(&self, value: T) -> Result<(), QueueError>
Try to send a value into the queue (from the control thread).
§Errors
Returns QueueFull if the queue is at capacity, or
ChannelDisconnected if the receiver has been dropped.
Sourcepub fn try_recv(&self) -> Result<T, QueueError>
pub fn try_recv(&self) -> Result<T, QueueError>
Try to receive a value from the queue (from the signal thread).
§Errors
Returns QueueEmpty if no value is available, or
ChannelDisconnected if the sender has been dropped.
Trait Implementations§
Source§impl<T> Clone for CommandQueue<T>
impl<T> Clone for CommandQueue<T>
Source§impl TelemetryQueueExt for CommandQueue<Telemetry>
impl TelemetryQueueExt for CommandQueue<Telemetry>
Source§fn send_parameter(
&self,
port: PortId,
parameter: ParameterId,
value: f32,
) -> Result<(), QueueError>
fn send_parameter( &self, port: PortId, parameter: ParameterId, value: f32, ) -> Result<(), QueueError>
Send a parameter value telemetry event.
Source§fn send_signal(
&self,
node_id: NodeId,
channel: usize,
data: Vec<f32>,
) -> Result<(), QueueError>
fn send_signal( &self, node_id: NodeId, channel: usize, data: Vec<f32>, ) -> Result<(), QueueError>
Send a signal data telemetry event.
Source§fn send_signal_with_sample_rate(
&self,
node_id: NodeId,
channel: usize,
data: Vec<f32>,
sample_rate: f32,
) -> Result<(), QueueError>
fn send_signal_with_sample_rate( &self, node_id: NodeId, channel: usize, data: Vec<f32>, sample_rate: f32, ) -> Result<(), QueueError>
Send a signal data telemetry event with explicit sample rate.
Source§fn send_peak(&self, port: PortId, value: f32) -> Result<(), QueueError>
fn send_peak(&self, port: PortId, value: f32) -> Result<(), QueueError>
Send a peak value telemetry event.
Source§fn send_peak_with_hold(
&self,
port: PortId,
value: f32,
hold_time_ms: u32,
) -> Result<(), QueueError>
fn send_peak_with_hold( &self, port: PortId, value: f32, hold_time_ms: u32, ) -> Result<(), QueueError>
Send a peak value telemetry event with hold time.
Source§fn send_event(
&self,
source: &str,
kind: &str,
data: Vec<f32>,
) -> Result<(), QueueError>
fn send_event( &self, source: &str, kind: &str, data: Vec<f32>, ) -> Result<(), QueueError>
Send an event telemetry event.
Auto Trait Implementations§
impl<T> Freeze for CommandQueue<T>
impl<T> RefUnwindSafe for CommandQueue<T>
impl<T> Send for CommandQueue<T>where
T: Send,
impl<T> Sync for CommandQueue<T>where
T: Send,
impl<T> Unpin for CommandQueue<T>where
T: Unpin,
impl<T> UnsafeUnpin for CommandQueue<T>
impl<T> UnwindSafe for CommandQueue<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more