pub struct Checkbox {
pub checked: bool,
pub label: String,
}Expand description
A boolean toggle widget.
label is rendered next to the toggle. checked is the current
state. Use Checkbox::toggle to flip, or Checkbox::set to
assign directly.
Fields§
§checked: boolWhether the box is currently checked.
label: StringHuman-readable label rendered next to the box.
Implementations§
Source§impl Checkbox
impl Checkbox
Sourcepub const fn update(&mut self, event: KeyEvent) -> (Changed, MenuAction)
pub const fn update(&mut self, event: KeyEvent) -> (Changed, MenuAction)
Apply a key event.
Space and Enter toggle the checked state. Esc returns
MenuAction::Cancelled. All other events are ignored.
Sourcepub fn apply(&mut self, event: FormEvent) -> (Changed, MenuAction)
pub fn apply(&mut self, event: FormEvent) -> (Changed, MenuAction)
Apply a form event.
Trait Implementations§
impl Eq for Checkbox
impl StructuralPartialEq for Checkbox
Auto Trait Implementations§
impl Freeze for Checkbox
impl RefUnwindSafe for Checkbox
impl Send for Checkbox
impl Sync for Checkbox
impl Unpin for Checkbox
impl UnsafeUnpin for Checkbox
impl UnwindSafe for Checkbox
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more