use std::any::{Any, TypeId}; use std::fmt::{self, Debug, Formatter, Write}; use std::iter; use std::mem; use std::ptr; use std::sync::Arc; use comemo::Prehashed; use ecow::{eco_format, eco_vec, EcoString, EcoVec}; use super::{Content, ElemFunc, Element, Label, Location, Vt}; use crate::diag::{SourceResult, StrResult, Trace, Tracepoint}; use crate::eval::{cast_from_value, Args, Cast, CastInfo, Dict, Func, Regex, Value, Vm}; use crate::model::Locatable; use crate::syntax::Span; use crate::util::pretty_array_like; /// 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