Struct procss::ast::Css

source ·
pub struct Css<'a>(pub Vec<FlatRuleset<'a>>);
Expand description

A non-nested “flat” CSS representation, suitable for browser output. The Css AST is typically generated via the crate::ast::Tree::flatten_tree method.

Tuple Fields§

§0: Vec<FlatRuleset<'a>>

Implementations§

A mutable transform which walks this AST recursively, invoking f for all nodes of type T.

Example
use procss::{ast, parse, RenderCss};
let mut css = parse("div{color: red;}").unwrap().flatten_tree();
css.transform(|rule: &mut ast::Rule| {
    rule.value = "green".into();
});

assert_eq!(css.as_css_string(), "div{color:green;}");

Iterate over the immediate children of this Tree (non-recursive).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Render self as a valid CSS String, minified (with non-interpretation-impacting whitespace removed).

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.