pub struct ToggleSwitch<'text> { /* private fields */ }👎Deprecated: Use tui-framework-experiment instead
Expand description
A toggle switch widget
Displays a switch that can be toggled on or off
§Examples
use ratatui::widgets::Widget;
use ratatui_widgets::toggle_switch::{ToggleSwitch, State};
let toggle_switch = ToggleSwitch::new("Toggle me", State::Off);
frame.render_widget(toggle_switch, frame.area());Implementations§
Source§impl<'text> ToggleSwitch<'text>
impl<'text> ToggleSwitch<'text>
Source§impl ToggleSwitch<'_>
impl ToggleSwitch<'_>
pub fn toggle_state(&mut self)
👎Deprecated: Use tui-framework-experiment instead
pub fn toggle_on(&mut self)
👎Deprecated: Use tui-framework-experiment instead
pub fn toggle_off(&mut self)
👎Deprecated: Use tui-framework-experiment instead
pub fn focus(&mut self)
👎Deprecated: Use tui-framework-experiment instead
pub fn blur(&mut self)
👎Deprecated: Use tui-framework-experiment instead
Trait Implementations§
Source§impl<'text> Clone for ToggleSwitch<'text>
impl<'text> Clone for ToggleSwitch<'text>
Source§fn clone(&self) -> ToggleSwitch<'text>
fn clone(&self) -> ToggleSwitch<'text>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'text> Debug for ToggleSwitch<'text>
impl<'text> Debug for ToggleSwitch<'text>
Source§impl EventHandler for ToggleSwitch<'_>
impl EventHandler for ToggleSwitch<'_>
Source§fn handle_key(&mut self, key_event: KeyPressedEvent)
fn handle_key(&mut self, key_event: KeyPressedEvent)
👎Deprecated: Use tui-framework-experiment instead
Source§fn handle_event(&mut self, event: Event)
fn handle_event(&mut self, event: Event)
👎Deprecated: Use tui-framework-experiment instead
Source§fn handle_mouse(&mut self, event: MouseEvent)
fn handle_mouse(&mut self, event: MouseEvent)
👎Deprecated: Use tui-framework-experiment instead
Auto Trait Implementations§
impl<'text> Freeze for ToggleSwitch<'text>
impl<'text> RefUnwindSafe for ToggleSwitch<'text>
impl<'text> Send for ToggleSwitch<'text>
impl<'text> Sync for ToggleSwitch<'text>
impl<'text> Unpin for ToggleSwitch<'text>
impl<'text> UnwindSafe for ToggleSwitch<'text>
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<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