use {
super::KeyframeSelector,
crate::domain::{
properties::{
DoesNotHaveImportance,
PropertyDeclaration,
PropertyDeclarations,
},
HasPropertyDeclarations,
},
cssparser::ToCss,
std::fmt,
};
#[derive(Debug, Clone)]
pub struct Keyframe {
pub selector: KeyframeSelector,
pub property_declarations: PropertyDeclarations<DoesNotHaveImportance>,
}
impl ToCss for Keyframe {
fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result {
self.selector.to_css(dest)?;
dest.write_char('{')?;
self.property_declarations.to_css(dest)?;
dest.write_char('}')?;
Ok(())
}
}
impl HasPropertyDeclarations<DoesNotHaveImportance> for Keyframe {
#[inline(always)]
fn property_declarations(
&self,
) -> &PropertyDeclarations<DoesNotHaveImportance> {
&self.property_declarations
}
#[inline(always)]
fn property_declarations_mut(
&mut self,
) -> &mut PropertyDeclarations<DoesNotHaveImportance> {
&mut self.property_declarations
}
#[inline(always)]
fn property_declarations_slice(
&self,
) -> &[PropertyDeclaration<DoesNotHaveImportance>] {
&self.property_declarations.0[..]
}
#[inline(always)]
fn property_declarations_vec(
&self,
) -> &Vec<PropertyDeclaration<DoesNotHaveImportance>> {
&self.property_declarations.0
}
#[inline(always)]
fn property_declarations_vec_mut(
&mut self,
) -> &mut Vec<PropertyDeclaration<DoesNotHaveImportance>> {
&mut self.property_declarations.0
}
}