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: Vec<T>) -> Self
pub fn new(themes: Vec<T>) -> Self
Create a cursor from an explicit list. 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.
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
Mutably borrows from an owned value. Read more