pub struct SubscriptionManager { /* private fields */ }Expand description
Subscription manager
Implementations§
Source§impl SubscriptionManager
impl SubscriptionManager
Sourcepub async fn add_subscription(
&self,
stream: String,
symbol: String,
sub_type: SubscriptionType,
sender: UnboundedSender<Value>,
) -> Result<()>
pub async fn add_subscription( &self, stream: String, symbol: String, sub_type: SubscriptionType, sender: UnboundedSender<Value>, ) -> Result<()>
Adds a subscription to the manager
Sourcepub async fn remove_subscription(&self, stream: &str) -> Result<()>
pub async fn remove_subscription(&self, stream: &str) -> Result<()>
Removes a subscription by stream name
Sourcepub async fn get_subscription(&self, stream: &str) -> Option<Subscription>
pub async fn get_subscription(&self, stream: &str) -> Option<Subscription>
Retrieves a subscription by stream name
Sourcepub async fn has_subscription(&self, stream: &str) -> bool
pub async fn has_subscription(&self, stream: &str) -> bool
Checks whether a subscription exists for the given stream
Sourcepub async fn get_all_subscriptions(&self) -> Vec<Subscription>
pub async fn get_all_subscriptions(&self) -> Vec<Subscription>
Returns all registered subscriptions
Sourcepub async fn get_subscriptions_by_symbol(
&self,
symbol: &str,
) -> Vec<Subscription>
pub async fn get_subscriptions_by_symbol( &self, symbol: &str, ) -> Vec<Subscription>
Returns all subscriptions associated with a symbol
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Returns the number of active subscriptions
Sourcepub async fn send_to_stream(&self, stream: &str, message: Value) -> bool
pub async fn send_to_stream(&self, stream: &str, message: Value) -> bool
Sends a message to subscribers of a specific stream
Sourcepub async fn send_to_symbol(&self, symbol: &str, message: &Value) -> usize
pub async fn send_to_symbol(&self, symbol: &str, message: &Value) -> usize
Sends a message to all subscribers of a symbol
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SubscriptionManager
impl !RefUnwindSafe for SubscriptionManager
impl Send for SubscriptionManager
impl Sync for SubscriptionManager
impl Unpin for SubscriptionManager
impl !UnwindSafe for SubscriptionManager
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