grass/src/style.rs

21 lines
459 B
Rust
Raw Normal View History

2020-06-16 19:38:30 -04:00
use codemap::Spanned;
2020-04-12 19:37:12 -04:00
2020-07-08 21:31:21 -04:00
use crate::{error::SassResult, interner::InternedString, value::Value};
/// A style: `color: red`
2020-07-10 00:17:15 -04:00
#[derive(Clone, Debug)]
pub(crate) struct Style {
2020-07-08 21:31:21 -04:00
pub property: InternedString,
2020-06-25 00:27:24 -04:00
pub value: Box<Spanned<Value>>,
}
impl Style {
2020-04-12 19:37:12 -04:00
pub fn to_string(&self) -> SassResult<String> {
Ok(format!(
"{}: {};",
self.property,
self.value.node.to_css_string(self.value.span)?
))
}
}