pub struct Tree<'a>(pub Vec<TreeRuleset<'a>>);Expand description
Tuple Fields§
§0: Vec<TreeRuleset<'a>>Implementations§
source§impl<'a> Tree<'a>
impl<'a> Tree<'a>
sourcepub fn flatten_tree(&self) -> Css<'a>
pub fn flatten_tree(&self) -> Css<'a>
sourcepub fn transform<T>(&mut self, f: impl FnMut(&mut T))where
Self: TransformCss<T>,
pub fn transform<T>(&mut self, f: impl FnMut(&mut T))where
Self: TransformCss<T>,
A mutable transform which walks this AST recursively, invoking f for
all nodes of type T.
Example
use procss::{ast, parse, RenderCss};
let mut tree = parse("div{color: red;}").unwrap();
tree.transform(|rule: &mut ast::Rule| {
rule.value = "green".into();
});
let css = tree.flatten_tree().as_css_string();
assert_eq!(css, "div{color:green;}");sourcepub fn iter(&self) -> impl Iterator<Item = &TreeRuleset<'a>>
pub fn iter(&self) -> impl Iterator<Item = &TreeRuleset<'a>>
Iterate over the immediate children of this Tree (non-recursive).