pub struct LivePublisher<S> { /* private fields */ }Expand description
The handle that replaces a channel’s root value.
Each channel has one publisher: it isn’t Clone, and publishing takes &mut self. Dropping it closes the channel.
Neither of these compiles:
ⓘ
let (publisher, _source) = saluki_common::sync::live::channel(0_u32);
let _second = publisher.clone();ⓘ
fn publish(publisher: &saluki_common::sync::live::LivePublisher<u32>) {
publisher.publish(1);
}Implementations§
Source§impl<S> LivePublisher<S>
impl<S> LivePublisher<S>
Sourcepub fn publish(&mut self, next: S)
pub fn publish(&mut self, next: S)
Replaces the root value with next and notifies the views.
This method does not validate next. New views read the current root; existing views refresh through
Live::changed. A later publication can replace next before a view reads it.
§Panics
If this releases the last reference to the previous root, a panic in its destructor propagates. The views are
notified of next first.
Auto Trait Implementations§
impl<S> Freeze for LivePublisher<S>
impl<S> RefUnwindSafe for LivePublisher<S>where
S: RefUnwindSafe,
impl<S> Send for LivePublisher<S>
impl<S> Sync for LivePublisher<S>
impl<S> Unpin for LivePublisher<S>
impl<S> UnsafeUnpin for LivePublisher<S>
impl<S> UnwindSafe for LivePublisher<S>where
S: RefUnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Track for T
impl<T> Track for T
Source§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self> ⓘ
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self> ⓘ
Instruments this type by attaching the given resource group token, returning a
Tracked wrapper. Read more