[−][src]Trait lsl::Pushable
A trait that enables the methods push_sample<T>()
and push_chunk<T>()
. Implemented by
StreamOutlet.
See also the ExPushable
trait for the extended-argument versions of these methods,
push_sample_ex<T>()
and push_chunk_ex<T>()
.
Note: If you push in data that as the wrong size (array length not matching the declared number of channels), these functions will trigger an assertion and panic.
Required methods
fn push_sample(&self, data: &T) -> Result<(), Error>
Push a vector of values of some type as a sample into the outlet. Each entry in the vector corresponds to one channel. The function handles type checking & conversion.
The data are time-stamped with the current time (using local_clock()
), and immediately
transmitted (unless a chunk_size
was provided at outlet construction, which overrides in what
granularity data are transmitted). See also push_chunk_ex()
(provided by ExPushable
trait)
for a variant that allows for overriding the timestamp and implicit push-through (flush)
behavior.
fn push_chunk(&self, data: &Vec<T>) -> Result<(), Error>
Push a chunk of samples (batched into a Vec
) into the outlet. Each element of the given
vector must itself be in a format accepted by push_sample()
(e.g., Vec
).
The data are time-stamped with the current time (using local_clock()
), and immediately
transmitted (unless a chunk_size
was provided at outlet construction, which causes the data
to be internally re-aggregated into chunks of that specified size for transmission). See also
push_chunk_ex()
(provided by ExPushable
trait) for a variant that allows for overriding the
timestamp and implicit push-through (flush) behavior.
fn push_chunk_stamped(
&self,
samples: &Vec<T>,
stamps: &Vec<f64>
) -> Result<(), Error>
&self,
samples: &Vec<T>,
stamps: &Vec<f64>
) -> Result<(), Error>
Push a chunk of samples (batched into a Vec
) along with a separate time stamp for each
sample (for irregular-rate streams) into the outlet.
Arguments:
samples
: AVec
of samples, each in a format accepted bypush_sample()
(e.g.,Vec
).timestamps
: AVec
of capture times for each sample, in agreement withlocal_clock()
.
The data are immediately transmitted (unless a chunk_size
was provided at outlet
construction, which causes the data to be internally re-aggregated into chunks of that
specified size for ttransmission). See also push_chunk_ex()
(provided by ExPushable
trait)
for a variant that allows for overriding this behavior.