State

Struct State 

Source
pub struct State {
    pub themes: IndexMap<String, ThemeEntry>,
    pub default_theme: String,
    pub current_theme: String,
    pub display_density: f32,
    pub scaled_density: f32,
    pub theme_variables: IndexMap<String, IndexMap<String, String>>,
    pub variables: IndexMap<String, String>,
    pub breakpoints: IndexMap<String, String>,
    pub used_selectors: IndexSet<String>,
    pub used_classes: IndexSet<String>,
    pub used_tags: IndexSet<String>,
    pub used_tag_classes: IndexSet<String>,
}

Fields§

§themes: IndexMap<String, ThemeEntry>§default_theme: String§current_theme: String§display_density: f32§scaled_density: f32§theme_variables: IndexMap<String, IndexMap<String, String>>§variables: IndexMap<String, String>§breakpoints: IndexMap<String, String>§used_selectors: IndexSet<String>§used_classes: IndexSet<String>§used_tags: IndexSet<String>§used_tag_classes: IndexSet<String>

Observed (tag, class) pairs. Encoded as “tag|class” for JSON simplicity.

Implementations§

Source§

impl State

Source

pub fn new_default() -> Self

Source

pub fn default_state() -> Self

Public helper to access the embedded default state.

Source

pub fn set_theme(&mut self, theme: impl Into<String>) -> Result<(), Error>

Source

pub fn add_theme(&mut self, name: impl Into<String>, styles: SelectorStyles)

Source

pub fn set_variables(&mut self, vars: IndexMap<String, String>)

Source

pub fn set_breakpoints(&mut self, map: IndexMap<String, String>)

Source

pub fn process_styles( &self, styles: IndexMap<String, Value>, ) -> IndexMap<String, Value>

Source

pub fn set_default_theme(&mut self, name: impl Into<String>)

Source

pub fn register_selectors<I: IntoIterator<Item = String>>( &mut self, selectors: I, )

Source

pub fn register_tailwind_classes<I: IntoIterator<Item = String>>( &mut self, classes: I, )

Source

pub fn register_tags<I: IntoIterator<Item = String>>(&mut self, tags: I)

Source

pub fn register_tag_class( &mut self, tag: impl Into<String>, class_: impl Into<String>, )

Source

pub fn clear_usage(&mut self)

Source

pub fn to_json(&self) -> Value

Source

pub fn from_json(value: Value) -> Result<Self>

Source

pub fn css_for_web(&self) -> String

Source

pub fn android_base_styles( &self, selector: &str, classes: &[String], ) -> IndexMap<String, Value>

Source

pub fn android_styles_for( &self, selector: &str, classes: &[String], ) -> IndexMap<String, Value>

Android-specific style transformations Converts CSS properties to Android-compatible values with platform-specific defaults Handles unit conversions (dp/sp to px) using display density

Source

pub fn effective_breakpoints(&self) -> IndexMap<String, String>

Trait Implementations§

Source§

impl Clone for State

Source§

fn clone(&self) -> State

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for State

Source§

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

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

impl Default for State

Source§

fn default() -> State

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for State

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for State

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

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