[][src]Struct foco::Broker

pub struct Broker<M> where
    M: TopicMeta + Default + Copy
{ /* fields omitted */ }

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]

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

impl<M> Sync for Broker<M> where
    <M as TopicMeta>::MsgType: Sync

impl<M> Unpin for Broker<M> where
    <M as TopicMeta>::MsgType: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.