Enum yew::callback::Callback [−][src]
pub enum Callback<IN> {
Callback {
cb: Rc<dyn Fn(IN)>,
passive: Option<bool>,
},
CallbackOnce(Rc<RefCell<Option<Box<dyn FnOnce(IN)>>>>),
}Expand description
Universal callback wrapper.
An `Rc` wrapper is used to make it cloneable.Variants
Callback
Fields
passive: Option<bool>Setting passive to Some explicitly makes the event listener passive or not.
Yew sets sane defaults depending on the type of the listener.
See
addEventListener.
A callback which can be called multiple times with optional modifier flags
CallbackOnce(Rc<RefCell<Option<Box<dyn FnOnce(IN)>>>>)
A callback which can only be called once. The callback will panic if it is called more than once.
Implementations
Creates a callback from an FnOnce. The programmer is responsible for ensuring
that the callback is only called once. If it is called more than once, the callback
will panic.
Trait Implementations
Convert self to Option<Callback<EVENT>>
Convert self to Option<Callback<EVENT>>
Auto Trait Implementations
impl<IN> !RefUnwindSafe for Callback<IN>
impl<IN> !UnwindSafe for Callback<IN>
Blanket Implementations
Mutably borrows from an owned value. Read more