Function css_image::parse

source ·
pub fn parse(css: &str) -> Result<HashMap<String, Style>, CssError<'static>>
Expand description

Parse CSS into a HashMap of selector name -> Style for easier manipulation

§Examples

use css_image::parse;

let css = r#"
body {
   background-color: #FFFFFF;
   width: 100px;
   height: 100px;
}
"#;

let mut result = parse(css).unwrap(); // HashMap of selector name -> Style

let body = result.get_mut("body").unwrap(); // Get the body element
body.content = Some("Hello, World!".to_string()); // Change the content of the body element