pub struct ThemeCursor<T> { /* private fields */ }Expand description
A cycling cursor over a list of themes of type T.
peek() returns the current theme without moving.
next() and prev() advance or retreat the cursor and return the new current theme.
Both wrap around at the ends.
To iterate over all themes without cycling, use ThemeCursor::themes.
§Type parameters
ThemeCursor<tca_types::Theme>— raw themes; seeThemeCursor::with_builtinsetc.- [
tca_ratatui::TcaThemeCursor] — resolved Ratatui themes; convenience constructors are available viatca_ratatui.
Implementations§
Source§impl<T> ThemeCursor<T>
impl<T> ThemeCursor<T>
Sourcepub fn new(themes: impl IntoIterator<Item = T>) -> Self
pub fn new(themes: impl IntoIterator<Item = T>) -> Self
Create a cursor from any iterable of themes. The cursor starts at the first theme.
Sourcepub fn next(&mut self) -> Option<&T>
pub fn next(&mut self) -> Option<&T>
Advances the cursor to the next theme (wrapping) and returns it.
Returns None if the cursor is empty.
Source§impl ThemeCursor<Theme>
Convenience constructors for ThemeCursor<Theme>.
impl ThemeCursor<Theme>
Convenience constructors for ThemeCursor<Theme>.
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
All built-in themes.
Sourcepub fn with_user_themes() -> Self
pub fn with_user_themes() -> Self
User-installed themes only.
Sourcepub fn with_all_themes() -> Self
pub fn with_all_themes() -> Self
Built-ins + user themes. User themes with matching names override builtins.
Sourcepub fn set_current(&mut self, name: &str) -> Option<&Theme>
pub fn set_current(&mut self, name: &str) -> Option<&Theme>
Moves the cursor to the theme matching name (slug-insensitive) and returns it.
Accepts fuzzy names: “Nord Dark”, “nord-dark”, and “nordDark” all match the same theme.
Returns None if no matching theme is found.
Trait Implementations§
Source§impl<T: Clone> Clone for ThemeCursor<T>
impl<T: Clone> Clone for ThemeCursor<T>
Source§fn clone(&self) -> ThemeCursor<T>
fn clone(&self) -> ThemeCursor<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for ThemeCursor<T>
impl<T: Debug> Debug for ThemeCursor<T>
Source§impl<T: PartialEq> PartialEq for ThemeCursor<T>
impl<T: PartialEq> PartialEq for ThemeCursor<T>
impl<T: Eq> Eq for ThemeCursor<T>
impl<T> StructuralPartialEq for ThemeCursor<T>
Auto Trait Implementations§
impl<T> Freeze for ThemeCursor<T>
impl<T> RefUnwindSafe for ThemeCursor<T>where
T: RefUnwindSafe,
impl<T> Send for ThemeCursor<T>where
T: Send,
impl<T> Sync for ThemeCursor<T>where
T: Sync,
impl<T> Unpin for ThemeCursor<T>where
T: Unpin,
impl<T> UnsafeUnpin for ThemeCursor<T>
impl<T> UnwindSafe for ThemeCursor<T>where
T: UnwindSafe,
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
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§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
key and return true if they are equal.