pub struct EventStream<MSG> { /* private fields */ }Expand description
A stream of messages to be used for widget/signal communication and inter-widget communication.
EventStream cannot be send to another thread. Use a Channel Sender instead.
Implementations§
Source§impl<MSG> EventStream<MSG>
impl<MSG> EventStream<MSG>
Sourcepub fn stream(&self) -> StreamHandle<MSG>
pub fn stream(&self) -> StreamHandle<MSG>
Synonym for downgrade().
Sourcepub fn downgrade(&self) -> StreamHandle<MSG>
pub fn downgrade(&self) -> StreamHandle<MSG>
Create a Clone-able EventStream handle.
Sourcepub fn lock(&self) -> Lock<MSG>
pub fn lock(&self) -> Lock<MSG>
Lock the stream (don’t emit message) until the Lock goes out of scope.
Sourcepub fn observe<CALLBACK: Fn(&MSG) + 'static>(&self, callback: CALLBACK)
pub fn observe<CALLBACK: Fn(&MSG) + 'static>(&self, callback: CALLBACK)
Add an observer to the event stream. This callback will be called every time a message is emmited.
Sourcepub fn set_callback<CALLBACK: FnMut(MSG) + 'static>(&self, callback: CALLBACK)
pub fn set_callback<CALLBACK: FnMut(MSG) + 'static>(&self, callback: CALLBACK)
Add a callback to the event stream. This is the main callback and received a owned version of the message, in contrast to observe().
Trait Implementations§
Auto Trait Implementations§
impl<MSG> Freeze for EventStream<MSG>
impl<MSG> RefUnwindSafe for EventStream<MSG>where
MSG: RefUnwindSafe,
impl<MSG> !Send for EventStream<MSG>
impl<MSG> !Sync for EventStream<MSG>
impl<MSG> Unpin for EventStream<MSG>
impl<MSG> UnwindSafe for EventStream<MSG>where
MSG: 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