pub struct Subscription {
pub stream: String,
pub symbol: String,
pub sub_type: SubscriptionType,
pub subscribed_at: Instant,
/* private fields */
}Expand description
Subscription metadata
Fields§
§stream: StringStream name (e.g. “btcusdt@ticker”)
symbol: StringNormalized trading symbol (e.g. “BTCUSDT”)
sub_type: SubscriptionTypeSubscription type descriptor
subscribed_at: InstantTimestamp when the subscription was created
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub fn new(
stream: String,
symbol: String,
sub_type: SubscriptionType,
sender: Sender<Value>,
) -> Self
pub fn new( stream: String, symbol: String, sub_type: SubscriptionType, sender: Sender<Value>, ) -> Self
Creates a new subscription with the provided parameters
Sourcepub fn add_sender(&self, sender: Sender<Value>)
pub fn add_sender(&self, sender: Sender<Value>)
Adds a new sender to this subscription for multi-subscriber support.
Sourcepub fn send(&self, message: Value) -> bool
pub fn send(&self, message: Value) -> bool
Sends a message to all subscribers, removing closed senders.
Returns true if at least one sender successfully received the message.
Sourcepub fn remove_ref(&self) -> usize
pub fn remove_ref(&self) -> usize
Decrements the reference count and returns the new value
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
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