pub struct Signal<T: Clone> { /* private fields */ }
Expand description
Implements a broadcast-listener / callback / observable pattern.
Signal
holds a list of subscriptions, each with a callback closure to run
on the next broadcast.
As rt-graph
uses GTK, the terminology (Signal
struct and its method names) match
GTK’s terms.
Implementations§
Source§impl<T: Clone> Signal<T>
impl<T: Clone> Signal<T>
Sourcepub fn connect<F>(&mut self, callback: F) -> SubscriptionIdwhere
F: Fn(T) + 'static,
pub fn connect<F>(&mut self, callback: F) -> SubscriptionIdwhere
F: Fn(T) + 'static,
Connect a new subscriber that will receive callbacks when the signal is raised.
Returns a SubscriptionId to disconnect the subscription when no longer required.
Sourcepub fn disconnect(&mut self, id: SubscriptionId)
pub fn disconnect(&mut self, id: SubscriptionId)
Disconnect an existing subscription.
Auto Trait Implementations§
impl<T> Freeze for Signal<T>
impl<T> !RefUnwindSafe for Signal<T>
impl<T> !Send for Signal<T>
impl<T> !Sync for Signal<T>
impl<T> Unpin for Signal<T>
impl<T> !UnwindSafe for Signal<T>
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