css_ast/functions/
calc_size_function.rs

1use css_parse::{Function, function_set};
2use csskit_derives::{Parse, Peek, ToCursors, ToSpan, Visitable};
3
4use crate::Todo;
5
6function_set!(pub struct CalcSizeFunctionName "calc-size");
7
8/// <https://drafts.csswg.org/css-values-5/#calc-size>
9///
10/// ```text,ignore
11/// <calc-size()> = calc-size( <calc-size-basis>, <calc-sum> )
12/// <calc-size-basis> = [ <size-keyword> | <calc-size()> | any | <calc-sum> ]
13/// ```
14///
15/// The `<size-keyword>` production matches any sizing keywords allowed in the context.
16/// For example, in width, it matches auto, min-content, stretch, etc.
17#[derive(Parse, Peek, ToCursors, ToSpan, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
18#[cfg_attr(feature = "serde", derive(serde::Serialize), serde(rename_all = "kebab-case"))]
19#[visit(self)]
20pub struct CalcSizeFunction(Function<CalcSizeFunctionName, Todo>);
21
22#[cfg(test)]
23mod tests {
24	use super::*;
25
26	#[test]
27	fn size_test() {
28		assert_eq!(std::mem::size_of::<CalcSizeFunction>(), 28);
29	}
30}