pub struct Css<'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.
Implementations
sourceimpl<'a> Css<'a>
impl<'a> 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 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;}");Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Css<'a>
impl<'a> Send for Css<'a>
impl<'a> Sync for Css<'a>
impl<'a> Unpin for Css<'a>
impl<'a> UnwindSafe for Css<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more