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_tag_classes: IndexSet<String>Observed (tag, class) pairs. Encoded as “tag|class” for JSON simplicity.
Implementations§
Source§impl State
impl State
pub fn new_default() -> Self
Sourcepub fn default_state() -> Self
pub fn default_state() -> Self
Public helper to access the embedded default state.
pub fn set_theme(&mut self, theme: impl Into<String>) -> Result<(), Error>
pub fn add_theme(&mut self, name: impl Into<String>, styles: SelectorStyles)
pub fn set_variables(&mut self, vars: IndexMap<String, String>)
pub fn set_breakpoints(&mut self, map: IndexMap<String, String>)
pub fn process_styles( &self, styles: IndexMap<String, Value>, ) -> IndexMap<String, Value>
pub fn set_default_theme(&mut self, name: impl Into<String>)
pub fn register_selectors<I: IntoIterator<Item = String>>( &mut self, selectors: I, )
pub fn register_tailwind_classes<I: IntoIterator<Item = String>>( &mut self, classes: I, )
pub fn register_tag_class( &mut self, tag: impl Into<String>, class_: impl Into<String>, )
pub fn clear_usage(&mut self)
pub fn to_json(&self) -> Value
pub fn from_json(value: Value) -> Result<Self>
pub fn css_for_web(&self) -> String
pub fn android_base_styles( &self, selector: &str, classes: &[String], ) -> IndexMap<String, Value>
Sourcepub fn android_styles_for(
&self,
selector: &str,
classes: &[String],
) -> IndexMap<String, Value>
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
pub fn effective_breakpoints(&self) -> IndexMap<String, String>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for State
impl<'de> Deserialize<'de> for State
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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> 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