pub struct EuvSwitchState {
pub checked: Signal<bool>,
}Expand description
The reactive state handle for the euv_switch component.
Registered against the current hook context slot via
HookContext::use_hook, so every render at the same hook index
observes the same Signal<bool> and the switch keeps its state
across re-renders.
Fields§
§checked: Signal<bool>The signal holding the switch checked state.
Implementations§
Source§impl EuvSwitchState
impl EuvSwitchState
Sourcepub fn new(checked: Signal<bool>) -> Self
pub fn new(checked: Signal<bool>) -> Self
Creates a state handle for the given checked signal.
The handle is a thin wrapper: it never owns the signal, it only
gives the view a place to hang Self::toggle and
Self::on_toggle without threading bare signals around.
§Arguments
Signal<bool>- The checked-state signal to wrap.
§Returns
EuvSwitchState- The state handle.
Sourcepub fn toggle(&self)
pub fn toggle(&self)
Flips the checked state of the switch.
The click handler is a no-op while the switch is disabled, so a disabled switch can never be flipped by a stray click.
Source§impl EuvSwitchState
impl EuvSwitchState
pub fn get_checked(&self) -> Signal<bool>
pub fn get_mut_checked(&mut self) -> &mut Signal<bool>
pub fn set_checked(&mut self, val: Signal<bool>) -> &mut Self
Trait Implementations§
Source§impl Clone for EuvSwitchState
impl Clone for EuvSwitchState
impl Copy for EuvSwitchState
Source§impl Debug for EuvSwitchState
impl Debug for EuvSwitchState
Auto Trait Implementations§
impl Freeze for EuvSwitchState
impl RefUnwindSafe for EuvSwitchState
impl Send for EuvSwitchState
impl Sync for EuvSwitchState
impl Unpin for EuvSwitchState
impl UnsafeUnpin for EuvSwitchState
impl UnwindSafe for EuvSwitchState
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