use std::fmt::{self, Debug, Formatter, Write}; use std::iter; use std::mem; use std::ptr; use comemo::Prehashed; use ecow::{eco_vec, EcoString, EcoVec}; use super::{Content, ElemFunc, Element, Selector, Vt}; use crate::diag::{SourceResult, Trace, Tracepoint}; use crate::eval::{cast, Args, FromValue, Func, IntoValue, Value, Vm}; use crate::syntax::Span; /// A list of style properties. #[derive(Default, PartialEq, Clone, Hash)] pub struct Styles(EcoVec>); impl Styles { /// Create a new, empty style list. pub fn new() -> Self { Self::default() } /// Whether this contains no styles. pub fn is_empty(&self) -> bool { self.0.is_empty() } /// Set an inner value for a style property. /// /// If the property needs folding and the value is already contained in the /// style map, `self` contributes the outer values and `value` is the inner /// one. pub fn set(&mut self, style: impl Into