Struct simple_pub_sub::topics::TopicMap
source · pub struct TopicMap {
pub map: BTreeMap<String, HashMap<String, Sender<Msg>>>,
}Expand description
The TopicMap struct is used to store the channels for a given topic.
Fields§
§map: BTreeMap<String, HashMap<String, Sender<Msg>>>Implementations§
source§impl TopicMap
impl TopicMap
sourcepub fn query(&self, topic: String) -> String
pub fn query(&self, topic: String) -> String
Returns the number of connected clients for a given topic.
sourcepub fn add_channel(
&mut self,
topic: String,
client_id: String,
channel: Sender<Msg>,
)
pub fn add_channel( &mut self, topic: String, client_id: String, channel: Sender<Msg>, )
Adds a channel to the map.
sourcepub fn remove_channel(&mut self, topic: String, client_id: String)
pub fn remove_channel(&mut self, topic: String, client_id: String)
Removes a channel from the map.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TopicMap
impl !RefUnwindSafe for TopicMap
impl Send for TopicMap
impl Sync for TopicMap
impl Unpin for TopicMap
impl !UnwindSafe for TopicMap
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