Function freya::prelude::use_future
pub fn use_future<T, F, D>(
cx: &ScopeState,
dependencies: D,
future: impl FnOnce(<D as UseFutureDep>::Out) -> F
) -> &UseFuture<T>where
T: 'static,
F: Future<Output = T> + 'static,
D: UseFutureDep,
Expand description
A future that resolves to a value.
This runs the future only once - though the future may be regenerated
through the UseFuture::restart
method.
This is commonly used for components that cannot be rendered until some asynchronous operation has completed.
Whenever the hooks dependencies change, the future will be re-evaluated. If a future is pending when the dependencies change, the previous future will be canceled before the new one is started.
- dependencies: a tuple of references to values that are PartialEq + Clone