pub struct Callback { /* private fields */ }Expand description
A generic callback handler for executing functions with stored arguments.
Callback allows you to associate a function with an argument and invoke
it later.
§Usage
Callback is use for creating a Option component. The callback will be
trigger when the Option component is selected.
§Example
use feather_tui as tui;
// Define a callback function that print out the argument that is was given
tui::tui_cbk_new_callback_func!(callback_func, argument, {
println!(
"Callback Argument: {}",
argument.downcast_ref::<u32>().unwrap());
});
let cb = tui::cbk::Callback::new(callback_func, 42u32);
cb.call(); // Prints: Callback Argument: 42Implementations§
Auto Trait Implementations§
impl Freeze for Callback
impl !RefUnwindSafe for Callback
impl !Send for Callback
impl !Sync for Callback
impl Unpin for Callback
impl !UnwindSafe for Callback
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