pub struct StyleSheet {
pub rules: Vec<StyleRule>,
}Expand description
A parsed stylesheet containing an ordered list of rules.
Use StyleSheet::parse to parse a CSS-like string, then
StyleSheet::resolve to compute the effective style for a component.
Fields§
§rules: Vec<StyleRule>Rules in source order (higher-index rules override earlier ones for the same specificity).
Implementations§
Source§impl StyleSheet
impl StyleSheet
Sourcepub fn parse(input: &str) -> Result<Self, String>
pub fn parse(input: &str) -> Result<Self, String>
Parses a stylesheet string into a StyleSheet.
Sourcepub fn resolve(
&self,
type_name: &str,
id: Option<&str>,
class: Option<&str>,
state: &WidgetState,
) -> Style
pub fn resolve( &self, type_name: &str, id: Option<&str>, class: Option<&str>, state: &WidgetState, ) -> Style
Resolves the effective style for a component by matching its type name, optional id, optional class, and pseudo-class state against all rules.
Specificity order: type < class < id. Pseudo-class rules have higher specificity than non-pseudo-class rules. Later rules override earlier ones at the same specificity.
Trait Implementations§
Source§impl Clone for StyleSheet
impl Clone for StyleSheet
Source§fn clone(&self) -> StyleSheet
fn clone(&self) -> StyleSheet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StyleSheet
impl Debug for StyleSheet
Source§impl Default for StyleSheet
impl Default for StyleSheet
Source§fn default() -> StyleSheet
fn default() -> StyleSheet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StyleSheet
impl RefUnwindSafe for StyleSheet
impl Send for StyleSheet
impl Sync for StyleSheet
impl Unpin for StyleSheet
impl UnsafeUnpin for StyleSheet
impl UnwindSafe for StyleSheet
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