[−][src]Struct foco::Broker
One message Broker per topic-constrained type: Each Broker provides a map from topic to message queue
Implementations
impl<M> Broker<M> where
M: TopicMeta + Default + Copy,
<M as TopicMeta>::MsgType: Default + Copy + Debug,
[src]
M: TopicMeta + Default + Copy,
<M as TopicMeta>::MsgType: Default + Copy + Debug,
pub fn new() -> Self
[src]
pub fn subscribe(&mut self, instance: PublisherId) -> Option<Subscription<M>>
[src]
Subscribe to a topic (and specific instance if desired)
Use ANY_PUBLISHER
to subscribe to the first available publisher
pub fn advertise(&mut self) -> Option<Advertisement<M>>
[src]
Advertise on a topic. This provides a publisher a route to publication
pub fn publish(&mut self, advert: &Advertisement<M>, msg: &M::MsgType)
[src]
Publish a new message on the topic
pub fn pub_registered(&self, instance: PublisherId) -> bool
[src]
Has this publisher already advertised? This merely tells the caller whether we have n >= instance number of registered (advertised) publishers.
pub fn group_count(&self) -> u32
[src]
How many publishers have advertised on this topic?
pub fn poll(&self, sub: &mut Subscription<M>) -> Result<M::MsgType, ()>
[src]
Read the next message from the topic
Returns nb::Error::WouldBlock
if the read would block
Auto Trait Implementations
impl<M> Send for Broker<M> where
<M as TopicMeta>::MsgType: Send,
<M as TopicMeta>::MsgType: Send,
impl<M> Sync for Broker<M> where
<M as TopicMeta>::MsgType: Sync,
<M as TopicMeta>::MsgType: Sync,
impl<M> Unpin for Broker<M> where
<M as TopicMeta>::MsgType: Unpin,
<M as TopicMeta>::MsgType: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,