pub struct TransitionConfig {
pub enter_ms: u32,
pub exit_ms: u32,
}Expand description
Configuration for a TransitionState.
Both fields are reactive (the underlying state holds a
Signal<TransitionConfig>), so consumers can adjust
the durations at runtime via change_config and any
pending timers driven by the old config will continue
using the old values until they next read the config
signal.
Fields§
§enter_ms: u32The duration of the enter animation, in milliseconds.
exit_ms: u32The duration of the exit animation, in milliseconds.
Implementations§
Source§impl TransitionConfig
Inherent implementation of TransitionConfig.
impl TransitionConfig
Inherent implementation of TransitionConfig.
Sourcepub const fn with_ms(ms: u32) -> Self
pub const fn with_ms(ms: u32) -> Self
Returns a config with both enter and exit durations
set to ms.
Named with_ms (not new) to avoid colliding
with the new constructor generated by
#[derive(New)]. (We don’t derive New here
because the field name enter_ms would generate
a set_enter_ms setter that nobody asked for —
keeping the struct Copy and writing it via
TransitionConfig { enter_ms, exit_ms } is
simpler.)
§Arguments
u32- A 32-bit unsigned integer (u32).
Sourcepub const fn with_durations(enter_ms: u32, exit_ms: u32) -> Self
pub const fn with_durations(enter_ms: u32, exit_ms: u32) -> Self
Returns a config with separate enter and exit
durations. See with_ms for the naming note.
§Arguments
u32- A 32-bit unsigned integer (u32).u32- A 32-bit unsigned integer (u32).
Sourcepub fn duration_for(&self, phase: TransitionPhase) -> u32
pub fn duration_for(&self, phase: TransitionPhase) -> u32
Source§impl TransitionConfig
impl TransitionConfig
pub fn get_enter_ms(&self) -> u32
pub fn get_mut_enter_ms(&mut self) -> &mut u32
pub fn set_enter_ms(&mut self, val: u32) -> &mut Self
pub fn get_exit_ms(&self) -> u32
pub fn get_mut_exit_ms(&mut self) -> &mut u32
pub fn set_exit_ms(&mut self, val: u32) -> &mut Self
Trait Implementations§
Source§impl Clone for TransitionConfig
impl Clone for TransitionConfig
Source§fn clone(&self) -> TransitionConfig
fn clone(&self) -> TransitionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TransitionConfig
Source§impl Debug for TransitionConfig
impl Debug for TransitionConfig
Source§impl Default for TransitionConfig
Default-construction for TransitionConfig.
impl Default for TransitionConfig
Default-construction for TransitionConfig.
Source§fn default() -> Self
fn default() -> Self
Constructs a default TransitionConfig value.