pub struct ThemeRegistry { /* private fields */ }Expand description
Built-in + user themes combined. User themes override built-ins
of the same name (with a warning). When two user files declare
the same name, the first one loaded wins and the later one is
warned + skipped — matches docs/specs/theming.md §Edge cases.
Files are processed in filename-sorted order, so “first” means
alphabetically first.
Implementations§
Source§impl ThemeRegistry
impl ThemeRegistry
Sourcepub fn with_built_ins() -> Self
pub fn with_built_ins() -> Self
Start with the compiled-in themes; no file I/O.
Sourcepub fn with_user_themes(self, dir: &Path, warn: impl FnMut(&str)) -> Self
pub fn with_user_themes(self, dir: &Path, warn: impl FnMut(&str)) -> Self
Load every *.toml in dir and merge into the registry. One
bad file never aborts the walk; each parse error emits a
diagnostic via warn and the file is skipped. Files are
processed in filename-sorted order. A user theme whose name
collides with a built-in replaces the built-in (with a
warning); a user theme whose name collides with an already-
loaded user theme is warned + skipped — per the spec’s
“first-user-theme-found wins” rule.
Sourcepub fn lookup(&self, name: &str) -> Option<&Theme>
pub fn lookup(&self, name: &str) -> Option<&Theme>
Look up a theme by its registered name. Returns None for
unknown names so resolve_theme can warn + fall back.
Sourcepub fn iter(&self) -> impl Iterator<Item = &RegisteredTheme>
pub fn iter(&self) -> impl Iterator<Item = &RegisteredTheme>
Enumerate registered themes in registration order: built-ins first (in compile-time order), then user themes sorted by filename.
Trait Implementations§
Source§impl Clone for ThemeRegistry
impl Clone for ThemeRegistry
Source§fn clone(&self) -> ThemeRegistry
fn clone(&self) -> ThemeRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more