//! A module to type styles. // TODO most stuff here is on the stack, but there are a few heap-allocs here and there. It would // be good if we could just to allocate them in the bump arena when using bumpalo. mod calc; mod codegen; mod color; pub mod string; mod syn_parse; use std::{ fmt, ops::{Deref, DerefMut}, }; pub use calc::*; pub use color::{Color, DynamicColor}; // pub use crate::{ // calc::*, // color::{Color, DynamicColor}, // }; pub struct DynamicStyles { pub rules: Vec, } impl From> for DynamicStyles { fn from(v: Vec) -> Self { Self { rules: v } } } impl fmt::Display for DynamicStyles { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for style in self .rules .iter() .filter(|style| !(style.is_dynamic() || style.is_dummy())) { write!(f, "{};", style)?; } Ok(()) } } // TODO make container generic over heap (e.g. support bumpalo) #[derive(Debug, Clone, PartialEq)] pub struct Styles { pub rules: Vec