#[repr(C)]pub struct Callback<Arg: ?Sized, Ret = ()> { /* private fields */ }
Expand description
A Callback that can be connected to a handler.
The Arg represents the argument. It should always be a tuple
Implementations§
Source§impl<Arg: ?Sized, Ret: Default> Callback<Arg, Ret>
impl<Arg: ?Sized, Ret: Default> Callback<Arg, Ret>
Sourcepub fn has_handler(&self) -> bool
pub fn has_handler(&self) -> bool
Return whether a callback is registered or not.
Sourcepub fn set_handler(&self, f: impl FnMut(&Arg) -> Ret + 'static)
pub fn set_handler(&self, f: impl FnMut(&Arg) -> Ret + 'static)
Set an handler to be called when the callback is called
There can only be one single handler per callback.
Trait Implementations§
Auto Trait Implementations§
impl<Arg, Ret = ()> !Freeze for Callback<Arg, Ret>
impl<Arg, Ret = ()> !RefUnwindSafe for Callback<Arg, Ret>
impl<Arg, Ret = ()> !Send for Callback<Arg, Ret>
impl<Arg, Ret = ()> !Sync for Callback<Arg, Ret>
impl<Arg, Ret> Unpin for Callback<Arg, Ret>where
Arg: ?Sized,
impl<Arg, Ret = ()> !UnwindSafe for Callback<Arg, Ret>
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