DataStream

Struct DataStream 

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

Data stream manager.

Manages subscriptions and handles incoming data.

Implementations§

Source§

impl DataStream

Source

pub fn new(config: StreamConfig) -> Self

Create a new data stream.

Source

pub fn state(&self) -> ConnectionState

Get connection state.

Source

pub fn set_state(&self, state: ConnectionState)

Set connection state.

Source

pub fn subscribe(&self, subscription: StreamSubscription) -> String

Subscribe to a data source.

Source

pub fn unsubscribe(&self, id: &str)

Unsubscribe from a data source.

Source

pub fn get_subscription(&self, id: &str) -> Option<StreamSubscription>

Get subscription by ID.

Source

pub fn subscriptions(&self) -> Vec<StreamSubscription>

Get all active subscriptions.

Source

pub fn get_data(&self, id: &str) -> Option<Value>

Get cached data for a subscription.

Source

pub fn handle_message(&self, msg: StreamMessage) -> Option<StreamMessage>

Handle an incoming message.

Source

pub fn take_outbox(&self) -> Vec<StreamMessage>

Take pending outbound messages.

Source

pub fn send(&self, msg: StreamMessage)

Queue an outbound message.

Source

pub fn reconnect_delay(&self) -> Duration

Get reconnection delay based on current attempts.

Source

pub fn increment_reconnect_attempts(&self)

Increment reconnection attempts.

Source

pub fn reset_reconnect_attempts(&self)

Reset reconnection attempts.

Source

pub fn should_reconnect(&self) -> bool

Check if we should try to reconnect.

Source

pub fn resubscribe_all(&self)

Resubscribe all subscriptions (after reconnect).

Source

pub fn subscription_count(&self) -> usize

Number of active subscriptions.

Source

pub fn clear(&self)

Clear all subscriptions and cache.

Trait Implementations§

Source§

impl Default for DataStream

Source§

fn default() -> DataStream

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.