pub struct Relay { /* private fields */ }
Expand description
Manages subscriptions and notifications for PubSub
.
Implementations§
§impl Relay
impl Relay
pub fn create_subscriber(&self) -> Subscriber
pub fn create_subscriber(&self) -> Subscriber
Create a new Subscriber
for this relay.
pub fn publish<Topic, P>(&self, topic: &Topic, payload: &P) -> Result<(), Error>
pub fn publish<Topic, P>(&self, topic: &Topic, payload: &P) -> Result<(), Error>
Publishes a payload
to all subscribers of topic
.
Errors
Returns an error if topic
or payload
fails to serialize with pot
.
pub fn publish_raw<Topic, Payload>(&self, topic: Topic, payload: Payload)
pub fn publish_raw<Topic, Payload>(&self, topic: Topic, payload: Payload)
Publishes a payload
to all subscribers of topic
.
pub fn publish_to_all<'topics, Topics, Topic, Payload>(
&self,
topics: Topics,
payload: &Payload
) -> Result<(), Error>where
Topics: IntoIterator<Item = &'topics Topic> + 'topics,
Topic: Serialize + 'topics,
Payload: Serialize,
pub fn publish_to_all<'topics, Topics, Topic, Payload>(
&self,
topics: Topics,
payload: &Payload
) -> Result<(), Error>where
Topics: IntoIterator<Item = &'topics Topic> + 'topics,
Topic: Serialize + 'topics,
Payload: Serialize,
Publishes a payload
to all subscribers of topic
.
Errors
Returns an error if topics
or payload
fail to serialize with pot
.
pub fn publish_raw_to_all(
&self,
topics: impl IntoIterator<Item = OwnedBytes>,
payload: impl Into<OwnedBytes>
)
pub fn publish_raw_to_all( &self, topics: impl IntoIterator<Item = OwnedBytes>, payload: impl Into<OwnedBytes> )
Publishes a payload
to all subscribers of topic
.
pub fn publish_message(&self, message: &Message)
pub fn publish_message(&self, message: &Message)
Publishes a message to all subscribers of its topic.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Relay
impl Send for Relay
impl Sync for Relay
impl Unpin for Relay
impl !UnwindSafe for Relay
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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