pub struct ThemeSwitcher { /* private fields */ }Expand description
A wrapping cursor over a list of themes.
use tui_nuances::ThemeSwitcher;
let mut s = ThemeSwitcher::new();
let first = s.current().name.clone();
s.next();
assert_ne!(s.current().name, first);
s.prev();
assert_eq!(s.current().name, first);
assert!(s.set_by_name("nord"));Implementations§
Source§impl ThemeSwitcher
impl ThemeSwitcher
Sourcepub fn new() -> ThemeSwitcher
pub fn new() -> ThemeSwitcher
Switcher over all built-in themes, starting at the first.
Sourcepub fn with_themes(themes: Vec<Theme>) -> ThemeSwitcher
pub fn with_themes(themes: Vec<Theme>) -> ThemeSwitcher
Switcher over custom themes. An empty list falls back to the built-ins.
Sourcepub fn set_index(&mut self, index: usize) -> &Theme
pub fn set_index(&mut self, index: usize) -> &Theme
Jump to index, wrapping modulo the number of themes.
Sourcepub fn set_by_name(&mut self, name: &str) -> bool
pub fn set_by_name(&mut self, name: &str) -> bool
Select a theme by name (same normalisation as Theme::by_name).
Returns false and keeps the selection when not found.
Trait Implementations§
Source§impl Clone for ThemeSwitcher
impl Clone for ThemeSwitcher
Source§fn clone(&self) -> ThemeSwitcher
fn clone(&self) -> ThemeSwitcher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThemeSwitcher
impl Debug for ThemeSwitcher
Source§impl Default for ThemeSwitcher
impl Default for ThemeSwitcher
Source§fn default() -> ThemeSwitcher
fn default() -> ThemeSwitcher
Returns the “default value” for a type. Read more
Source§impl PartialEq for ThemeSwitcher
impl PartialEq for ThemeSwitcher
impl StructuralPartialEq for ThemeSwitcher
Auto Trait Implementations§
impl Freeze for ThemeSwitcher
impl RefUnwindSafe for ThemeSwitcher
impl Send for ThemeSwitcher
impl Sync for ThemeSwitcher
impl Unpin for ThemeSwitcher
impl UnsafeUnpin for ThemeSwitcher
impl UnwindSafe for ThemeSwitcher
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