pub struct Relay { /* private fields */ }
Expand description
Manages subscriptions and notifications for PubSub
.
Implementations
sourceimpl Relay
impl Relay
sourcepub fn create_subscriber(&self) -> Subscriber
pub fn create_subscriber(&self) -> Subscriber
Create a new Subscriber
for this relay.
sourcepub fn publish<Topic: Serialize, P: Serialize>(
&self,
topic: &Topic,
payload: &P
) -> Result<(), Error>
pub fn publish<Topic: Serialize, P: Serialize>(
&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
.
sourcepub fn publish_raw<Topic: Into<OwnedBytes>, Payload: Into<OwnedBytes>>(
&self,
topic: Topic,
payload: Payload
)
pub fn publish_raw<Topic: Into<OwnedBytes>, Payload: Into<OwnedBytes>>(
&self,
topic: Topic,
payload: Payload
)
Publishes a payload
to all subscribers of topic
.
sourcepub fn publish_to_all<'topics, Topics: IntoIterator<Item = &'topics Topic> + 'topics, Topic: Serialize + 'topics, Payload: Serialize>(
&self,
topics: Topics,
payload: &Payload
) -> Result<(), Error>
pub fn publish_to_all<'topics, Topics: IntoIterator<Item = &'topics Topic> + 'topics, Topic: Serialize + 'topics, Payload: Serialize>(
&self,
topics: Topics,
payload: &Payload
) -> Result<(), Error>
Publishes a payload
to all subscribers of topic
.
Errors
Returns an error if topics
or payload
fail to serialize with pot
.
sourcepub 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
.
sourcepub 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more