Skip to main content

Fanout

Struct Fanout 

Source
pub struct Fanout { /* private fields */ }
Expand description

A set of consumers that all receive the same sample.

liblsl calls this the send buffer (src/send_buffer.h). Each consumer holds its own queue, so a slow consumer loses only its own samples. SPEC.md 8.8.

Implementations§

Source§

impl Fanout

Source

pub fn new() -> Self

Build an empty set.

Source

pub fn add(&self, capacity: usize) -> Arc<SampleQueue> ⓘ

Add a consumer with its own queue.

Source

pub fn remove(&self, q: &Arc<SampleQueue>)

Remove a consumer.

Source

pub fn count(&self) -> usize

How many consumers are connected.

Source

pub fn push(&self, s: &Sample)

Give one sample to every consumer.

A consumer that has gone away is dropped from the set. The call never waits, whatever any consumer is doing.

Source

pub fn push_many(&self, samples: &[Sample])

Give several samples to every consumer, with one lock for the set.

The result for each consumer is the same as one Fanout::push for each sample, in order.

Source

pub fn close(&self)

Close every consumer queue.

Trait Implementations§

Source§

impl Debug for Fanout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Fanout

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Fanout

§

impl Forget for Fanout

§

impl Move for Fanout

§

impl RefUnwindSafe for Fanout

§

impl Send for Fanout

§

impl Sync for Fanout

§

impl Unpin for Fanout

§

impl UnsafeUnpin for Fanout

§

impl UnwindSafe for Fanout

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> 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.