pub struct StateChange { /* private fields */ }
Expand description
Struct that store the callbacks for the states.
Implementations§
Source§impl StateChange
impl StateChange
Sourcepub fn on_state<F, Fut>(&mut self, state: State, f: F)
pub fn on_state<F, Fut>(&mut self, state: State, f: F)
Function that register callback(s) for the state(s).
§Example
use updatehub_sdk::listener;
listener.on_state(listener::State::Download, |mut handler| async move {
println!("function called when starting the Download state");
// Cancels the current download.
handler.cancel().await
});
Trait Implementations§
Source§impl Default for StateChange
impl Default for StateChange
Source§fn default() -> StateChange
fn default() -> StateChange
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StateChange
impl !RefUnwindSafe for StateChange
impl !Send for StateChange
impl !Sync for StateChange
impl Unpin for StateChange
impl !UnwindSafe for StateChange
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