css_ast/functions/
fit_content_function.rs1use crate::LengthPercentage;
2use css_parse::{Function, function_set};
3use csskit_derives::{Parse, Peek, ToCursors, ToSpan, Visitable};
4
5function_set!(pub struct FitContentFunctionName "fit-content");
6
7#[derive(Parse, Peek, ToCursors, ToSpan, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize))]
14#[visit(self)]
15pub struct FitContentFunction(Function<FitContentFunctionName, LengthPercentage>);
16
17#[cfg(test)]
18mod tests {
19 use super::*;
20 use css_parse::assert_parse;
21
22 #[test]
23 fn size_test() {
24 assert_eq!(std::mem::size_of::<FitContentFunction>(), 44);
25 }
26
27 #[test]
28 fn test_writes() {
29 assert_parse!(FitContentFunction, "fit-content(1px)");
30 assert_parse!(FitContentFunction, "fit-content(10%)");
31 }
32}