pub struct SubscriptionManager<S, Key = ()> {
pub stream_code: u32,
pub subscribes: HashMap<ConnectionId, SubscribeContext<S>>,
pub mappings: HashMap<Key, HashSet<ConnectionId>>,
}Fields§
§stream_code: u32§subscribes: HashMap<ConnectionId, SubscribeContext<S>>§mappings: HashMap<Key, HashSet<ConnectionId>>Implementations§
Source§impl<S, Key: Eq + Hash> SubscriptionManager<S, Key>
impl<S, Key: Eq + Hash> SubscriptionManager<S, Key>
pub fn new(stream_code: u32) -> Self
pub fn subscribe( &mut self, ctx: RequestContext, setting: S, modify: impl FnOnce(&mut SubscribeContext<S>), )
pub fn subscribe_with_keys( &mut self, ctx: RequestContext, keys: Vec<Key>, setting: S, modify: impl FnOnce(&mut SubscribeContext<S>), )
pub fn subscribe_with( &mut self, ctx: RequestContext, keys: Vec<Key>, new: impl FnOnce() -> S, modify: impl FnOnce(&mut SubscribeContext<S>), )
pub fn unsubscribe(&mut self, connection_id: ConnectionId)
pub fn unsubscribe_with( &mut self, connection_id: ConnectionId, remove: impl Fn(&mut SubscribeContext<S>) -> (bool, Vec<Key>), )
pub fn publish_to( &mut self, toolbox: &ArcToolbox, connection_id: ConnectionId, msg: &impl Serialize, )
pub fn publish_to_key<Q>( &mut self, toolbox: &ArcToolbox, key: &Q, msg: &impl Serialize, )
pub fn publish_to_keys<Q>( &mut self, toolbox: &ArcToolbox, keys: &[&Q], msg: &impl Serialize, )
pub fn publish_with_filter<M: Serialize>( &mut self, toolbox: &ArcToolbox, filter: impl Fn(&SubscribeContext<S>) -> Option<M>, )
pub fn publish_to_all(&mut self, toolbox: &ArcToolbox, msg: &impl Serialize)
Auto Trait Implementations§
impl<S, Key> Freeze for SubscriptionManager<S, Key>
impl<S, Key> RefUnwindSafe for SubscriptionManager<S, Key>where
Key: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, Key> Send for SubscriptionManager<S, Key>
impl<S, Key> Sync for SubscriptionManager<S, Key>
impl<S, Key> Unpin for SubscriptionManager<S, Key>
impl<S, Key> UnwindSafe for SubscriptionManager<S, Key>where
Key: UnwindSafe,
S: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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