pub struct SessionTopicMap<T, TX> { /* private fields */ }Expand description
Map of generic topics to session ids and of session ids to a channel sender.
Implementations§
Source§impl<T, TX> SessionTopicMap<T, TX>
impl<T, TX> SessionTopicMap<T, TX>
Sourcepub fn insert_with_topic(&mut self, session_id: u64, topic: T, tx: TX)
pub fn insert_with_topic(&mut self, session_id: u64, topic: T, tx: TX)
Insert a session id with their topic and tx channel.
Sourcepub fn drop(&mut self, session_id: u64) -> bool
pub fn drop(&mut self, session_id: u64) -> bool
Drop a session from all mappings.
Returns true if the session existed and was dropped, otherwise returns false when the session was known
Sourcepub fn topic(&self, session_id: u64) -> Option<&T>
pub fn topic(&self, session_id: u64) -> Option<&T>
Get the topic for a session id.
Returns None of the session id was not known.
Sourcepub fn sessions(&self, topic: &T) -> HashSet<u64>
pub fn sessions(&self, topic: &T) -> HashSet<u64>
Get ids for all sessions associated with the given topic.
Sourcepub fn sender_mut(&mut self, session_id: u64) -> Option<&mut TX>
pub fn sender_mut(&mut self, session_id: u64) -> Option<&mut TX>
Get a mutable reference to a session sender.
Trait Implementations§
Source§impl<T: Clone, TX: Clone> Clone for SessionTopicMap<T, TX>
impl<T: Clone, TX: Clone> Clone for SessionTopicMap<T, TX>
Source§fn clone(&self) -> SessionTopicMap<T, TX>
fn clone(&self) -> SessionTopicMap<T, TX>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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<T, TX> Freeze for SessionTopicMap<T, TX>
impl<T, TX> RefUnwindSafe for SessionTopicMap<T, TX>where
TX: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, TX> Send for SessionTopicMap<T, TX>
impl<T, TX> Sync for SessionTopicMap<T, TX>
impl<T, TX> Unpin for SessionTopicMap<T, TX>
impl<T, TX> UnsafeUnpin for SessionTopicMap<T, TX>
impl<T, TX> UnwindSafe for SessionTopicMap<T, TX>where
TX: UnwindSafe,
T: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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