pub type ResponseVar<T> = ReadOnlyVar<Response<T>, ArcVar<Response<T>>>;
Expand description
Variable used to listen to a one time signal that an async operation has completed.
Use response_var
or response_done_var
to init.
Aliased Type§
struct ResponseVar<T>(/* private fields */);
Implementations§
Source§impl<T: VarValue> ResponseVar<T>
impl<T: VarValue> ResponseVar<T>
Sourcepub fn with_rsp<R>(&self, read: impl FnOnce(&T) -> R) -> Option<R>
pub fn with_rsp<R>(&self, read: impl FnOnce(&T) -> R) -> Option<R>
Visit the response, if present.
Sourcepub fn with_new_rsp<R>(&self, read: impl FnOnce(&T) -> R) -> Option<R>
pub fn with_new_rsp<R>(&self, read: impl FnOnce(&T) -> R) -> Option<R>
Visit the response, if present and new.
Sourcepub fn is_waiting(&self) -> bool
pub fn is_waiting(&self) -> bool
If the response is not received yet.
Sourcepub async fn wait_rsp(&self) -> T
pub async fn wait_rsp(&self) -> T
Returns a future that awaits until a response is received and then returns a clone.
Sourcepub async fn wait_into_rsp(self) -> T
pub async fn wait_into_rsp(self) -> T
Returns a future that awaits until a response is received and then returns it.
Will clone the value if the variable is shared.
Note that ResponseVar<T>
implements IntoFuture
so you can also just .await
the variable.
Sourcepub fn into_rsp(self) -> Option<T>
pub fn into_rsp(self) -> Option<T>
Into response, if received.
Clones if the variable is has more than one strong reference.
Sourcepub fn map_rsp<O, I, M>(&self, waiting_value: I, map: M) -> impl Var<O>
pub fn map_rsp<O, I, M>(&self, waiting_value: I, map: M) -> impl Var<O>
Map the response value using map
, if the variable is awaiting a response uses the waiting_value
first.
Sourcepub fn map_response<O, M>(&self, map: M) -> ResponseVar<O>
pub fn map_response<O, M>(&self, map: M) -> ResponseVar<O>
Map to another response variable.
Trait Implementations§
Source§impl<T: VarValue> IntoFuture for ResponseVar<T>
impl<T: VarValue> IntoFuture for ResponseVar<T>
Source§impl<T: VarValue, V: Var<T>> AnyVar for ReadOnlyVar<T, V>
impl<T: VarValue, V: Var<T>> AnyVar for ReadOnlyVar<T, V>
Source§fn clone_any(&self) -> BoxedAnyVar
fn clone_any(&self) -> BoxedAnyVar
Source§fn as_unboxed_any(&self) -> &dyn Any
fn as_unboxed_any(&self) -> &dyn Any
dyn Any
methods, on the underlying variable type if boxed.Source§fn var_type_id(&self) -> TypeId
fn var_type_id(&self) -> TypeId
Source§fn get_any(&self) -> Box<dyn AnyVarValue>
fn get_any(&self) -> Box<dyn AnyVarValue>
Source§fn with_any(&self, read: &mut dyn FnMut(&dyn AnyVarValue))
fn with_any(&self, read: &mut dyn FnMut(&dyn AnyVarValue))
Source§fn with_new_any(&self, read: &mut dyn FnMut(&dyn AnyVarValue)) -> bool
fn with_new_any(&self, read: &mut dyn FnMut(&dyn AnyVarValue)) -> bool
is_new
.Source§fn set_any(&self, _: Box<dyn AnyVarValue>) -> Result<(), VarIsReadOnlyError>
fn set_any(&self, _: Box<dyn AnyVarValue>) -> Result<(), VarIsReadOnlyError>
value
for the variable, it will be set in the end of the current app update. Read moreSource§fn last_update(&self) -> VarUpdateId
fn last_update(&self) -> VarUpdateId
VARS.update_id
the variable is new.Source§fn is_contextual(&self) -> bool
fn is_contextual(&self) -> bool
Source§fn capabilities(&self) -> VarCapability
fn capabilities(&self) -> VarCapability
Source§fn hook_any(
&self,
pos_modify_action: Box<dyn Fn(&AnyVarHookArgs<'_>) -> bool + Send + Sync>,
) -> VarHandle
fn hook_any( &self, pos_modify_action: Box<dyn Fn(&AnyVarHookArgs<'_>) -> bool + Send + Sync>, ) -> VarHandle
modify
closure. The closure can return if it is retained after each call. If you modify another variable in a
hook the modification applies in the same update, variable mapping and binding is implemented using hooks. Read moreSource§fn hook_animation_stop(
&self,
handler: Box<dyn FnOnce() + Send>,
) -> Result<(), Box<dyn FnOnce() + Send>>
fn hook_animation_stop( &self, handler: Box<dyn FnOnce() + Send>, ) -> Result<(), Box<dyn FnOnce() + Send>>
handler
to be called when the current animation stops. Read moreSource§fn strong_count(&self) -> usize
fn strong_count(&self) -> usize
Source§fn weak_count(&self) -> usize
fn weak_count(&self) -> usize
Source§fn actual_var_any(&self) -> BoxedAnyVar
fn actual_var_any(&self) -> BoxedAnyVar
ContextVar<T>
, gets a clone of self
for other var types.Source§fn downgrade_any(&self) -> BoxedAnyWeakVar
fn downgrade_any(&self) -> BoxedAnyWeakVar
Source§fn is_animating(&self) -> bool
fn is_animating(&self) -> bool
Source§fn modify_importance(&self) -> usize
fn modify_importance(&self) -> usize
Source§fn var_ptr(&self) -> VarPtr<'_>
fn var_ptr(&self) -> VarPtr<'_>
Source§fn update(&self) -> Result<(), VarIsReadOnlyError>
fn update(&self) -> Result<(), VarIsReadOnlyError>
Source§impl<T: VarValue, V: Var<T>> Var<T> for ReadOnlyVar<T, V>
impl<T: VarValue, V: Var<T>> Var<T> for ReadOnlyVar<T, V>
Source§type ReadOnly = ReadOnlyVar<T, V>
type ReadOnly = ReadOnlyVar<T, V>
Var::read_only
.Source§type Downgrade = WeakReadOnlyVar<T, <V as Var<T>>::Downgrade>
type Downgrade = WeakReadOnlyVar<T, <V as Var<T>>::Downgrade>
Var::downgrade
.Source§type FlatMap<O: VarValue, VF: Var<O>> = <V as Var<T>>::FlatMap<O, VF>
type FlatMap<O: VarValue, VF: Var<O>> = <V as Var<T>>::FlatMap<O, VF>
Var::flat_map
.Source§type FilterMapBidi<O: VarValue> = <V as Var<T>>::FilterMap<O>
type FilterMapBidi<O: VarValue> = <V as Var<T>>::FilterMap<O>
Var::filter_map_bidi
.Source§type MapRefBidi<O: VarValue> = <V as Var<T>>::MapRef<O>
type MapRefBidi<O: VarValue> = <V as Var<T>>::MapRef<O>
Var::map_ref_bidi
.Source§fn modify<F>(&self, _: F) -> Result<(), VarIsReadOnlyError>
fn modify<F>(&self, _: F) -> Result<(), VarIsReadOnlyError>
Source§fn boxed(self) -> BoxedVar<T>where
Self: Sized,
fn boxed(self) -> BoxedVar<T>where
Self: Sized,
BoxedVar<T>
, does not double box.Source§fn actual_var(self) -> Self::ActualVar
fn actual_var(self) -> Self::ActualVar
Source§fn into_value(self) -> T
fn into_value(self) -> T
Source§fn read_only(&self) -> Self::ReadOnly
fn read_only(&self) -> Self::ReadOnly
Source§fn map<O, M>(&self, map: M) -> Self::Map<O>
fn map<O, M>(&self, map: M) -> Self::Map<O>
Source§fn map_bidi<O, M, B>(&self, map: M, _: B) -> Self::MapBidi<O>
fn map_bidi<O, M, B>(&self, map: M, _: B) -> Self::MapBidi<O>
Source§fn flat_map<O, VF, M>(&self, map: M) -> Self::FlatMap<O, VF>
fn flat_map<O, VF, M>(&self, map: M) -> Self::FlatMap<O, VF>
Source§fn filter_map<O, M, I>(&self, map: M, fallback: I) -> Self::FilterMap<O>
fn filter_map<O, M, I>(&self, map: M, fallback: I) -> Self::FilterMap<O>
Source§fn filter_map_bidi<O, M, B, I>(
&self,
map: M,
_: B,
fallback: I,
) -> Self::FilterMapBidi<O>
fn filter_map_bidi<O, M, B, I>( &self, map: M, _: B, fallback: I, ) -> Self::FilterMapBidi<O>
Source§fn map_ref<O, M>(&self, map: M) -> Self::MapRef<O>
fn map_ref<O, M>(&self, map: M) -> Self::MapRef<O>
self
. The map
closure is called for each value access, it must reference the
value O
that already exists in T
.Source§fn map_ref_bidi<O, M, B>(&self, map: M, _: B) -> Self::MapRefBidi<O>
fn map_ref_bidi<O, M, B>(&self, map: M, _: B) -> Self::MapRefBidi<O>
self
. The map
closure is called for each value access, it must reference the
value O
that already exists in T
, the map_mut
closure is called for every modify request, it must do the same
as map
but with mutable access.Source§fn easing_with<F, S>(
&self,
duration: Duration,
easing: F,
sampler: S,
) -> Self::Easingwhere
T: Transitionable,
F: Fn(EasingTime) -> EasingStep + Send + Sync + 'static,
S: Fn(&Transition<T>, EasingStep) -> T + Send + Sync + 'static,
fn easing_with<F, S>(
&self,
duration: Duration,
easing: F,
sampler: S,
) -> Self::Easingwhere
T: Transitionable,
F: Fn(EasingTime) -> EasingStep + Send + Sync + 'static,
S: Fn(&Transition<T>, EasingStep) -> T + Send + Sync + 'static,
Source§fn boxed_any(self) -> BoxedAnyVarwhere
Self: Sized,
fn boxed_any(self) -> BoxedAnyVarwhere
Self: Sized,
BoxedAnyVar
, does not double box.Source§fn hook(
&self,
pos_modify_action: impl Fn(&VarHookArgs<'_, T>) -> bool + Send + Sync + 'static,
) -> VarHandle
fn hook( &self, pos_modify_action: impl Fn(&VarHookArgs<'_, T>) -> bool + Send + Sync + 'static, ) -> VarHandle
modify
closure. The closure can return if it is retained after each call. If you modify another variable in a
hook the modification applies in the same update, variable mapping and binding is implemented using hooks. Read moreSource§fn wait_update(&self) -> impl Future<Output = VarUpdateId> + Send + Sync
fn wait_update(&self) -> impl Future<Output = VarUpdateId> + Send + Sync
last_update
to change. Read moreSource§fn wait_value(
&self,
predicate: impl Fn(&T) -> bool + Send + Sync,
) -> impl Future<Output = ()> + Send + Sync
fn wait_value( &self, predicate: impl Fn(&T) -> bool + Send + Sync, ) -> impl Future<Output = ()> + Send + Sync
predicate
.Source§fn with_new<R, F>(&self, read: F) -> Option<R>
fn with_new<R, F>(&self, read: F) -> Option<R>
is_new
.Source§fn get_ne(&self, value: &mut T) -> bool
fn get_ne(&self, value: &mut T) -> bool
value
if the current value is not equal to it.Source§fn get_new_into(&self, value: &mut T) -> bool
fn get_new_into(&self, value: &mut T) -> bool
value
if the current value is_new
.Source§fn get_new_ne(&self, value: &mut T) -> bool
fn get_new_ne(&self, value: &mut T) -> bool
value
if the variable value is_new
and not equal to the value
.Source§fn set<I>(&self, value: I) -> Result<(), VarIsReadOnlyError>where
I: Into<T>,
fn set<I>(&self, value: I) -> Result<(), VarIsReadOnlyError>where
I: Into<T>,
value
for the variable, it will be set in the end of the current app update.Source§fn set_from<I>(&self, other: &I) -> Result<(), VarIsReadOnlyError>where
I: Var<T>,
fn set_from<I>(&self, other: &I) -> Result<(), VarIsReadOnlyError>where
I: Var<T>,
value
for the variable, it will be set in the end of the current app update to the updated
value of other
, so if the other var has already scheduled an update, the updated value will be used. Read moreSource§fn set_from_map<Iv, I, M>(
&self,
other: &I,
map: M,
) -> Result<(), VarIsReadOnlyError>
fn set_from_map<Iv, I, M>( &self, other: &I, map: M, ) -> Result<(), VarIsReadOnlyError>
other
value at the time of update, mapped to the type of self
.Source§fn filter_try_into<O, I>(&self, fallback: I) -> Self::FilterMap<O>
fn filter_try_into<O, I>(&self, fallback: I) -> Self::FilterMap<O>
Source§fn filter_parse<O, I>(&self, fallback: I) -> Self::FilterMap<O>
fn filter_parse<O, I>(&self, fallback: I) -> Self::FilterMap<O>
Source§fn bind_filter_map<T2, V2, F>(&self, other: &V2, map: F) -> VarHandle
fn bind_filter_map<T2, V2, F>(&self, other: &V2, map: F) -> VarHandle
other
with the new values of self
transformed by map
, if the closure returns a value. Read moreSource§fn bind_map_bidi<T2, V2, M, B>(
&self,
other: &V2,
map: M,
map_back: B,
) -> VarHandles
fn bind_map_bidi<T2, V2, M, B>( &self, other: &V2, map: M, map_back: B, ) -> VarHandles
Source§fn bind_filter_map_bidi<T2, V2, M, B>(
&self,
other: &V2,
map: M,
map_back: B,
) -> VarHandles
fn bind_filter_map_bidi<T2, V2, M, B>( &self, other: &V2, map: M, map_back: B, ) -> VarHandles
self
to other
and back with the new values of self
transformed by map
and the new values of other
transformed
by map_back
, the value is assigned in a update only if the closures returns a value. Read moreSource§fn set_bind<V2>(&self, other: &V2) -> VarHandlewhere
V2: Var<T>,
fn set_bind<V2>(&self, other: &V2) -> VarHandlewhere
V2: Var<T>,
other.set_from(self)
and self.bind(other)
.Source§fn bind_bidi<V2>(&self, other: &V2) -> VarHandleswhere
V2: Var<T>,
fn bind_bidi<V2>(&self, other: &V2) -> VarHandleswhere
V2: Var<T>,
other
with the new values of self
and self
with the new values of other
. Read moreSource§fn trace_value<E, S>(&self, enter_value: E) -> VarHandle
fn trace_value<E, S>(&self, enter_value: E) -> VarHandle
Source§fn animate<A>(&self, animate: A) -> AnimationHandle
fn animate<A>(&self, animate: A) -> AnimationHandle
Source§fn sequence<A>(&self, animate: A) -> VarHandle
fn sequence<A>(&self, animate: A) -> VarHandle
animate
, the closure is called once at the start to begin, then again every time
the variable stops animating. Read moreSource§fn set_ease<S, E, F>(
&self,
start_value: S,
end_value: E,
duration: Duration,
easing: F,
) -> AnimationHandle
fn set_ease<S, E, F>( &self, start_value: S, end_value: E, duration: Duration, easing: F, ) -> AnimationHandle
Source§fn set_ease_oci<S, E, F>(
&self,
start_value: S,
end_value: E,
duration: Duration,
easing: F,
) -> AnimationHandle
fn set_ease_oci<S, E, F>( &self, start_value: S, end_value: E, duration: Duration, easing: F, ) -> AnimationHandle
Source§fn set_ease_with<S, E, F, Sa>(
&self,
start_value: S,
end_value: E,
duration: Duration,
easing: F,
sampler: Sa,
) -> AnimationHandlewhere
T: Transitionable,
S: Into<T>,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
Sa: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
fn set_ease_with<S, E, F, Sa>(
&self,
start_value: S,
end_value: E,
duration: Duration,
easing: F,
sampler: Sa,
) -> AnimationHandlewhere
T: Transitionable,
S: Into<T>,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
Sa: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
start_value
to end_value
using a custom value sampler. Read moreSource§fn set_ease_oci_with<S, E, F, Sa>(
&self,
start_value: S,
end_value: E,
duration: Duration,
easing: F,
sampler: Sa,
) -> AnimationHandlewhere
T: Transitionable,
S: Into<T>,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
Sa: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
fn set_ease_oci_with<S, E, F, Sa>(
&self,
start_value: S,
end_value: E,
duration: Duration,
easing: F,
sampler: Sa,
) -> AnimationHandlewhere
T: Transitionable,
S: Into<T>,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
Sa: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
start_value
to end_value
with an easing transition using a custom value sampler. Read moreSource§fn ease<E, F>(
&self,
new_value: E,
duration: Duration,
easing: F,
) -> AnimationHandle
fn ease<E, F>( &self, new_value: E, duration: Duration, easing: F, ) -> AnimationHandle
new_value
. Read moreSource§fn ease_oci<E, F>(
&self,
new_value: E,
duration: Duration,
easing: F,
) -> AnimationHandle
fn ease_oci<E, F>( &self, new_value: E, duration: Duration, easing: F, ) -> AnimationHandle
new_value
with an easing transition. Read moreSource§fn ease_with<E, F, S>(
&self,
new_value: E,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
fn ease_with<E, F, S>(
&self,
new_value: E,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
new_value
using a custom value sampler. Read moreSource§fn ease_oci_with<E, F, S>(
&self,
new_value: E,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
fn ease_oci_with<E, F, S>(
&self,
new_value: E,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
E: Into<T>,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&Transition<T>, EasingStep) -> T + Send + 'static,
new_value
with an easing transition and a custom value sampler. Read moreSource§fn set_ease_keyed<F>(
&self,
keys: Vec<(Factor, T)>,
duration: Duration,
easing: F,
) -> AnimationHandle
fn set_ease_keyed<F>( &self, keys: Vec<(Factor, T)>, duration: Duration, easing: F, ) -> AnimationHandle
Source§fn set_ease_keyed_with<F, S>(
&self,
keys: Vec<(Factor, T)>,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&TransitionKeyed<T>, EasingStep) -> T + Send + 'static,
fn set_ease_keyed_with<F, S>(
&self,
keys: Vec<(Factor, T)>,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&TransitionKeyed<T>, EasingStep) -> T + Send + 'static,
Source§fn ease_keyed<F>(
&self,
keys: Vec<(Factor, T)>,
duration: Duration,
easing: F,
) -> AnimationHandle
fn ease_keyed<F>( &self, keys: Vec<(Factor, T)>, duration: Duration, easing: F, ) -> AnimationHandle
Source§fn ease_keyed_with<F, S>(
&self,
keys: Vec<(Factor, T)>,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&TransitionKeyed<T>, EasingStep) -> T + Send + 'static,
fn ease_keyed_with<F, S>(
&self,
keys: Vec<(Factor, T)>,
duration: Duration,
easing: F,
sampler: S,
) -> AnimationHandlewhere
T: Transitionable,
F: Fn(EasingTime) -> EasingStep + Send + 'static,
S: Fn(&TransitionKeyed<T>, EasingStep) -> T + Send + 'static,
Source§fn step_oci<N>(&self, new_value: N, delay: Duration) -> AnimationHandlewhere
N: Into<T>,
fn step_oci<N>(&self, new_value: N, delay: Duration) -> AnimationHandlewhere
N: Into<T>,
new_value
, every time the delay
elapses the variable is set to the next value.Source§fn set_step_oci<V0, V1>(
&self,
from: V0,
to: V1,
delay: Duration,
) -> AnimationHandle
fn set_step_oci<V0, V1>( &self, from: V0, to: V1, delay: Duration, ) -> AnimationHandle
from
and to
, the variable is set to from
to start and every time the delay
elapses
the variable is set to the next value.Source§fn steps<F>(
&self,
steps: Vec<(Factor, T)>,
duration: Duration,
easing: F,
) -> AnimationHandle
fn steps<F>( &self, steps: Vec<(Factor, T)>, duration: Duration, easing: F, ) -> AnimationHandle
duration
elapses. Read moreSource§fn chase<N, F>(
&self,
first_target: N,
duration: Duration,
easing: F,
) -> ChaseAnimation<T>
fn chase<N, F>( &self, first_target: N, duration: Duration, easing: F, ) -> ChaseAnimation<T>
ChaseAnimation<T>
handle.Source§fn debug(&self) -> VarDebug<'_, T, Self>
fn debug(&self) -> VarDebug<'_, T, Self>
fmt::Debug
to write the var value.Source§fn display(&self) -> VarDisplay<'_, T, Self>where
T: Display,
fn display(&self) -> VarDisplay<'_, T, Self>where
T: Display,
fmt::Display
to write the var value.