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.
Trait Implementations§
Source§impl Clone for OriginProducer
impl Clone for OriginProducer
Source§fn clone(&self) -> OriginProducer
fn clone(&self) -> OriginProducer
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for OriginProducer
impl Default for OriginProducer
Source§fn default() -> OriginProducer
fn default() -> OriginProducer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OriginProducer
impl RefUnwindSafe for OriginProducer
impl Send for OriginProducer
impl Sync for OriginProducer
impl Unpin for OriginProducer
impl UnwindSafe for OriginProducer
Blanket Implementations§
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