pub struct PersistedCallback<T, U = ()>(_);
Expand description

This is a wrapper around a Callback which can persist through the lifetime of a component.

Usually, this struct is created by using the use_callback() hook.

As with Callback, this only supports closures with exactly one input argument and some return value. The underlying Rust closure will be dropped when all of the following conditions are met:

  • All clones have been dropped.
  • All clones to the underlying Callback have been dropped.
  • The React component has unmounted.

It can be dropped earlier, e.g. when the underlying Callback has been replaced by another and no more clones exist.

Methods from Deref<Target = Callback<T, U>>

Returns a Rust closure from the callback.

Returns a new Callback by prepending the given closure to the callback.

Returns a new Callback by appending the given closure to the callback.

Returns a reference to JsValue of the callback.

Trait Implementations

Calls the struct with the given input argument.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.