Skip to main content

FeedClient

Struct FeedClient 

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

The client side of a data feed.

Implementations§

Source§

impl FeedClient

Source

pub fn start( params: FeedParams, format: Format, channels: usize, ) -> (Self, Vec<u8>)

Build a client and return the bytes to send.

Source

pub fn start_with( params: FeedParams, format: Format, channels: usize, offer: Vec<Token>, ) -> (Self, Vec<u8>)

Build a client that offers features, and return the bytes to send.

With no tokens, this is the same as FeedClient::start. docs/extensions.md.

Source

pub fn features(&self) -> &[Token]

The features that are on for this connection. Empty until the headers arrive, and empty when the outlet gave no answer for them.

Source

pub fn state(&self) -> State

The current state.

Source

pub fn agreement(&self) -> Option<&FeedAgreement>

What the answer settled. Available once the headers arrive.

Source

pub fn codec(&self) -> Option<&Codec>

The codec for the sample stream. Available once the headers arrive.

Source

pub fn on_headers(&mut self, buf: &[u8]) -> Result<usize, Error>

Read the answer headers.

Returns the number of bytes used. A buffer with no complete block returns Error::Incomplete, and the caller reads more bytes.

Source

pub fn on_test_pattern(&mut self, buf: &[u8]) -> Result<usize, TestPatternError>

Read the two test pattern samples and compare them. SPEC.md 6.

The client builds the expected samples itself. A mismatch means the formats differ, and liblsl stops the feed with a named error.

Returns the number of bytes used.

Source

pub fn on_samples(&self, buf: &[u8]) -> Result<(Vec<Sample>, usize), Error>

Read samples from the stream.

Auto Trait Implementations§

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.