pub struct OriginProducer { /* private fields */ }Expand description
Announces broadcasts to consumers over the network.
Implementations§
Source§impl OriginProducer
impl OriginProducer
pub fn new() -> Self
Sourcepub fn publish<S: ToString>(&mut self, path: S, broadcast: BroadcastConsumer)
pub fn publish<S: ToString>(&mut self, path: S, broadcast: BroadcastConsumer)
Publish a broadcast, announcing it to all consumers.
The broadcast will be unannounced when it is closed. If there is already a broadcast with the same path, then it will be replaced and reannounced. If the old broadcast is closed before the new one, then nothing will happen. If the new broadcast is closed before the old one, then the old broadcast will be reannounced.
Sourcepub fn publish_all(&mut self, broadcasts: OriginConsumer)
pub fn publish_all(&mut self, broadcasts: OriginConsumer)
Publish all broadcasts from the given origin.
Sourcepub fn publish_prefix(&mut self, prefix: &str, broadcasts: OriginConsumer)
pub fn publish_prefix(&mut self, prefix: &str, broadcasts: OriginConsumer)
Publish all broadcasts from the given origin with an optional prefix.
Sourcepub fn consume(&self, path: &str) -> Option<BroadcastConsumer>
pub fn consume(&self, path: &str) -> Option<BroadcastConsumer>
Get a specific broadcast by name.
The most recent, non-closed broadcast will be returned if there are duplicates.
Sourcepub fn consume_all(&self) -> OriginConsumer
pub fn consume_all(&self) -> OriginConsumer
Subscribe to all announced broadcasts.
Sourcepub fn consume_prefix<S: ToString>(&self, prefix: S) -> OriginConsumer
pub fn consume_prefix<S: ToString>(&self, prefix: S) -> OriginConsumer
Subscribe to all announced broadcasts matching the prefix.
Sourcepub fn consume_exact<S: ToString>(&self, path: S) -> OriginConsumer
pub fn consume_exact<S: ToString>(&self, path: S) -> OriginConsumer
Wait for an exact broadcast to be announced.
Trait Implementations§
Source§impl Clone for OriginProducer
impl Clone for OriginProducer
Source§fn clone(&self) -> OriginProducer
fn clone(&self) -> OriginProducer
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more