Struct hive_pubsub::Hive [−][src]
pub struct Hive<ClientKey: Clone + Eq + Hash, TopicKey: Clone + Eq + Hash, Data> {
pub map: Arc<Mutex<ManyToMany<ClientKey, TopicKey>>>,
// some fields omitted
}
Expand description
The pubsub client.
Example Usage
use hive_pubsub::{Hive, PubSub};
let mut hive = Hive::new(
|users, data| {
// do something with users and data
}
);
hive.subscribe_multiple(1, vec! [ 2, 3 ]).unwrap();
hive.publish(&2, "Data sent for topic 2.".to_string()).unwrap();
Fields
map: Arc<Mutex<ManyToMany<ClientKey, TopicKey>>>
Implementations
Trait Implementations
Add a subscription to a topic.
Add several subscriptions to a topic.
Remove a subscription to a topic.
Remove several subscriptions to a topic.
Auto Trait Implementations
impl<ClientKey, TopicKey, Data> RefUnwindSafe for Hive<ClientKey, TopicKey, Data>
impl<ClientKey, TopicKey, Data> Send for Hive<ClientKey, TopicKey, Data> where
ClientKey: Send,
TopicKey: Send,
impl<ClientKey, TopicKey, Data> Sync for Hive<ClientKey, TopicKey, Data> where
ClientKey: Send,
TopicKey: Send,
impl<ClientKey, TopicKey, Data> UnwindSafe for Hive<ClientKey, TopicKey, Data>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more