pub struct StyleSheet { /* private fields */ }Expand description
A parsed CSS stylesheet.
Implementations§
Source§impl StyleSheet
impl StyleSheet
Sourcepub fn parse(css: &str) -> Result<Self>
pub fn parse(css: &str) -> Result<Self>
Parse a CSS string into a StyleSheet.
This is a minimal subset parser — enough for Bubba’s declarative UI.
Supported: class selectors (.foo), basic property: value; pairs.
Sourcepub fn resolve(&self, class: &str) -> Option<&HashMap<String, String>>
pub fn resolve(&self, class: &str) -> Option<&HashMap<String, String>>
Look up all properties for a given class name.
Sourcepub fn get(&self, class: &str, property: &str) -> Option<&str>
pub fn get(&self, class: &str, property: &str) -> Option<&str>
Look up a specific property for a class.
Sourcepub fn merge(&mut self, other: StyleSheet)
pub fn merge(&mut self, other: StyleSheet)
Merge another stylesheet into this one (later rules win).
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Number of rules in this stylesheet.
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 · 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