Struct relm::EventStream
source · 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> 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