pub struct Switch<'a> { /* private fields */ }Expand description
A sliding on/off switch bound to a &mut bool.
Implementations§
Source§impl<'a> Switch<'a>
impl<'a> Switch<'a>
Sourcepub fn new(state: &'a mut bool, label: impl Into<WidgetText>) -> Self
pub fn new(state: &'a mut bool, label: impl Into<WidgetText>) -> Self
Create a switch bound to state with the given label.
Pass "" for the label if the switch is rendered alongside a
separately-laid-out caption (e.g., in a settings row).
Sourcepub fn accent(self, accent: Accent) -> Self
pub fn accent(self, accent: Accent) -> Self
Colour the “on” state with the given accent. Default: Accent::Sky.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Switch<'a>
impl<'a> RefUnwindSafe for Switch<'a>
impl<'a> Send for Switch<'a>
impl<'a> Sync for Switch<'a>
impl<'a> Unpin for Switch<'a>
impl<'a> UnsafeUnpin for Switch<'a>
impl<'a> !UnwindSafe for Switch<'a>
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