Skip to main content

Schema

Struct Schema 

Source
pub struct Schema {
    pub schema_version: u32,
    pub active: String,
    pub themes: BTreeMap<String, Palette>,
    pub theme_families: BTreeMap<String, String>,
    pub wallpaper_options: BTreeMap<String, Vec<String>>,
    pub paths: Paths,
    pub palette: Palette,
}

Fields§

§schema_version: u32§active: String

name of the theme used when a caller doesn’t ask for one

§themes: BTreeMap<String, Palette>

every theme, keyed by slug

§theme_families: BTreeMap<String, String>

Family name for each embedded theme, preserved from its source directory instead of being guessed from its slug by consumers.

§wallpaper_options: BTreeMap<String, Vec<String>>

Governed wallpaper resources that can be paired with each theme.

§paths: Paths§palette: Palette

The resolved active theme — filled in by load, not present in the JSON. Kept as a field (not a method) so schema::load().palette keeps compiling for pre-v2 callers.

Implementations§

Source§

impl Schema

Source

pub fn theme(&self, name: &str) -> Option<&Palette>

A theme by slug, or None if it isn’t defined.

Source

pub fn active_theme(&self) -> &Palette

The active theme (same value as self.palette).

Source

pub fn theme_names(&self) -> impl Iterator<Item = &str>

All theme slugs, sorted.

Source

pub fn theme_family(&self, name: &str) -> Option<&str>

The source family for an embedded theme, if one was recorded.

Trait Implementations§

Source§

impl Debug for Schema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Schema

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Schema, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.