1use alloc::{
2 string::{String, ToString},
3 vec::Vec,
4};
5
6use crate::sheet::borrow::Array;
7use crate::typing::*;
8use core::fmt;
9use cssparser::ToCss;
10
11fn generate_array_str<T: fmt::Display>(array: &Array<T>) -> String {
12 let mut str = String::new();
13 for index in 0..array.len() {
14 str.push_str(&array[index].to_string());
15 if index + 1 < array.len() {
16 str.push_str(", ");
17 }
18 }
19 str
20}
21
22impl fmt::Display for CalcExpr {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 match self {
25 Self::Number(num) => write!(f, "{}", num),
26 Self::Angle(angle) => write!(f, "{}", angle),
27 Self::Length(length) => write!(f, "{}", length),
28 Self::Div(lhs, rhs) => write!(f, "{}/{}", lhs, rhs),
29 Self::Mul(lhs, rhs) => write!(f, "{}*{}", lhs, rhs),
30 Self::Plus(lhs, rhs) => write!(f, "{} + {}", lhs, rhs),
31 Self::Sub(lhs, rhs) => write!(f, "{} - {}", lhs, rhs),
32 }
33 }
34}
35
36impl fmt::Display for Number {
37 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38 write!(
39 f,
40 "{}",
41 match self {
42 Number::F32(a) => a.to_string(),
43 Number::I32(a) => a.to_string(),
44 Number::Calc(expr) => expr.to_string(),
45 }
46 )
47 }
48}
49impl fmt::Display for Display {
50 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
51 write!(
52 f,
53 "{}",
54 match self {
55 Self::None => "none",
56 Self::Block => "block",
57 Self::Flex => "flex",
58 Self::Inline => "inline",
59 Self::InlineBlock => "inline-block",
60 Self::Grid => "grid",
61 Self::FlowRoot => "flow-root",
62 Self::InlineFlex => "inline-flex",
63 }
64 )
65 }
66}
67impl fmt::Display for Color {
68 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
69 let mut color = String::new();
70 write!(
71 f,
72 "{}",
73 match self {
74 Self::Undefined => "undefined",
75 Self::CurrentColor => "currentcolor",
76 Self::Specified(r, g, b, a) => {
77 let rgba = cssparser_color::RgbaLegacy::new(*r, *g, *b, (*a) as f32 / 255.);
78 cssparser_color::Color::Rgba(rgba).to_css(&mut color)?;
79 let str = match color.as_str() {
80 "rgb(0, 0, 0)" => "black",
81 "rgb(192, 192, 192)" => "silver",
82 "rgb(128, 128, 128)" => "gray",
83 "rgb(255, 255, 255)" => "white",
84 "rgb(128, 0, 0)" => "maroon",
85 "rgb(255, 0, 0)" => "red",
86 "rgb(128, 0, 128)" => "purple",
87 "rgb(255, 0, 255)" => "fuchsia",
88 "rgb(0, 128, 0)" => "green",
89 "rgb(0, 255, 0)" => "lime",
90 "rgb(128, 128, 0)" => "olive",
91 "rgb(255, 255, 0)" => "yellow",
92 "rgb(0, 0, 128)" => "navy",
93 "rgb(0, 0, 255)" => "blue",
94 "rgb(0, 128, 128)" => "teal",
95 "rgb(0, 255, 255)" => "aqua",
96 "rgb(240, 248, 255)" => "aliceblue",
97 "rgb(250, 235, 215)" => "antiquewhite",
98 "rgb(127, 255, 212)" => "aquamarine",
99 "rgb(240, 255, 255)" => "azure",
100 "rgb(245, 245, 220)" => "beige",
101 "rgb(255, 228, 196)" => "bisque",
102 "rgb(255, 235, 205)" => "blanchedalmond",
103 "rgb(138, 43, 226)" => "blueviolet",
104 "rgb(165, 42, 42)" => "brown",
105 "rgb(222, 184, 135)" => "burlywood",
106 "rgb(95, 158, 160)" => "cadetblue",
107 "rgb(127, 255, 0)" => "chartreuse",
108 "rgb(210, 105, 30)" => "chocolate",
109 "rgb(255, 127, 80)" => "coral",
110 "rgb(100, 149, 237)" => "cornflowerblue",
111 "rgb(255, 248, 220)" => "cornsilk",
112 "rgb(220, 20, 60)" => "crimson",
113 "rgb(0, 0, 139)" => "darkblue",
115 "rgb(0, 139, 139)" => "darkcyan",
116 "rgb(184, 134, 11)" => "darkgoldenrod",
117 "rgb(169, 169, 169)" => "darkgray",
118 "rgb(0, 100, 0)" => "darkgreen",
119 "rgb(189, 183, 107)" => "darkkhaki",
121 "rgb(139, 0, 139)" => "darkmagenta",
122 "rgb(85, 107, 47)" => "darkolivegreen",
123 "rgb(255, 140, 0)" => "darkorange",
124 "rgb(153, 50, 204)" => "darkorchid",
125 "rgb(139, 0, 0)" => "darkred",
126 "rgb(233, 150, 122)" => "darksalmon",
127 "rgb(143, 188, 143)" => "darkseagreen",
128 "rgb(72, 61, 139)" => "darkslateblue",
129 "rgb(47, 79, 79)" => "darkslategray",
130 "rgb(0, 206, 209)" => "darkturquoise",
132 "rgb(148, 0, 211)" => "darkviolet",
133 "rgb(255, 20, 147)" => "deeppink",
134 "rgb(0, 191, 255)" => "deepskyblue",
135 "rgb(105, 105, 105)" => "dimgray",
136 "rgb(30, 144, 255)" => "dodgerblue",
138 "rgb(178, 34, 34)" => "firebrick",
139 "rgb(255, 250, 240)" => "floralwhite",
140 "rgb(34, 139, 34)" => "forestgreen",
141 "rgb(220, 220, 220)" => "gainsboro",
142 "rgb(248, 248, 255)" => "ghostwhite",
143 "rgb(255, 215, 0)" => "gold",
144 "rgb(218, 165, 32)" => "goldenrod",
145 "rgb(173, 255, 47)" => "greenyellow",
146 "rgb(240, 255, 240)" => "honeydew",
148 "rgb(255, 105, 180)" => "hotpink",
149 "rgb(205, 92, 92)" => "indianred",
150 "rgb(75, 0, 130)" => "indigo",
151 "rgb(255, 255, 240)" => "ivory",
152 "rgb(240, 230, 140)" => "khaki",
153 "rgb(230, 230, 250)" => "lavender",
154 "rgb(255, 240, 245)" => "lavenderblush",
155 "rgb(124, 252, 0)" => "lawngreen",
156 "rgb(255, 250, 205)" => "lemonchiffon",
157 "rgb(173, 216, 230)" => "lightblue",
158 "rgb(240, 128, 128)" => "lightcoral",
159 "rgb(224, 255, 255)" => "lightcyan",
160 "rgb(250, 250, 210)" => "lightgoldenrodyellow",
161 "rgb(211, 211, 211)" => "lightgray",
162 "rgb(144, 238, 144)" => "lightgreen",
163 "rgb(255, 182, 193)" => "lightpink",
165 "rgb(255, 160, 122)" => "lightsalmon",
166 "rgb(32, 178, 170)" => "lightseagreen",
167 "rgb(135, 206, 250)" => "lightskyblue",
168 "rgb(119, 136, 153)" => "lightslategrey",
170 "rgb(176, 196, 222)" => "lightsteelblue",
171 "rgb(255, 255, 224)" => "lightyellow",
172 "rgb(50, 205, 50)" => "limegreen",
173 "rgb(102, 205, 170)" => "mediumaquamarine",
176 "rgb(0, 0, 205)" => "mediumblue",
177 "rgb(186, 85, 211)" => "mediumorchid",
178 "rgb(147, 112, 219)" => "mediumpurple",
179 "rgb(60, 179, 113)" => "mediumseagreen",
180 "rgb(123, 104, 238)" => "mediumslateblue",
181 "rgb(0, 250, 154)" => "mediumspringgreen",
182 "rgb(72, 209, 204)" => "mediumturquoise",
183 "rgb(199, 21, 133)" => "mediumvioletred",
184 "rgb(25, 25, 112)" => "midnightblue",
185 "rgb(245, 255, 250)" => "mintcream",
186 "rgb(255, 228, 225)" => "mistyrose",
187 "rgb(255, 228, 181)" => "moccasin",
188 "rgb(255, 222, 173)" => "navajowhite",
189 "rgb(253, 245, 230)" => "oldlace",
190 "rgb(107, 142, 35)" => "olivedrab",
191 "rgb(255, 165, 0)" => "orange",
192 "rgb(255, 69, 0)" => "orangered",
193 "rgb(218, 112, 214)" => "orchid",
194 "rgb(238, 232, 170)" => "palegoldenrod",
195 "rgb(152, 251, 152)" => "palegreen",
196 "rgb(175, 238, 238)" => "paleturquoise",
197 "rgb(219, 112, 147)" => "palevioletred",
198 "rgb(255, 239, 213)" => "papayawhip",
199 "rgb(255, 218, 185)" => "peachpuff",
200 "rgb(205, 133, 63)" => "peru",
201 "rgb(255, 192, 203)" => "pink",
202 "rgb(221, 160, 221)" => "plum",
203 "rgb(176, 224, 230)" => "powderblue",
204 "rgb(102, 51, 153)" => "rebeccapurple",
205 "rgb(188, 143, 143)" => "rosybrown",
206 "rgb(65, 105, 225)" => "royalblue",
207 "rgb(139, 69, 19)" => "saddlebrown",
208 "rgb(250, 128, 114)" => "salmon",
209 "rgb(244, 164, 96)" => "sandybrown",
210 "rgb(46, 139, 87)" => "seagreen",
211 "rgb(255, 245, 238)" => "seashell",
212 "rgb(160, 82, 45)" => "sienna",
213 "rgb(135, 206, 235)" => "skyblue",
214 "rgb(106, 90, 205)" => "slateblue",
215 "rgb(112, 128, 144)" => "slategrey",
217 "rgb(255, 250, 250)" => "snow",
218 "rgb(0, 255, 127)" => "springgreen",
219 "rgb(70, 130, 180)" => "steelblue",
220 "rgb(210, 180, 140)" => "tan",
221 "rgb(216, 191, 216)" => "thistle",
222 "rgb(255, 99, 71)" => "tomato",
223 "rgb(64, 224, 208)" => "turquoise",
224 "rgb(238, 130, 238)" => "violet",
225 "rgb(245, 222, 179)" => "wheat",
226 "rgb(245, 245, 245)" => "whitesmoke",
227 "rgb(154, 205, 50)" => "yellowgreen",
228 x => x,
229 };
230 color = str.to_string();
231 &color
232 }
233 }
234 )
235 }
236}
237impl fmt::Display for Length {
238 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
239 let tmp;
240 write!(
241 f,
242 "{}",
243 match self {
244 Length::Undefined => "null",
245 Length::Auto => "auto",
246 Length::Px(x) => {
247 tmp = format!("{}px", x);
248 &tmp
249 }
250 Length::Vw(x) => {
251 tmp = format!("{}vw", x);
252 &tmp
253 }
254 Length::Vh(x) => {
255 tmp = format!("{}vh", x);
256 &tmp
257 }
258 Length::Rem(x) => {
259 tmp = format!("{}rem", x);
260 &tmp
261 }
262 Length::Rpx(x) => {
263 tmp = format!("{}rpx", x);
264 &tmp
265 }
266 Length::Em(x) => {
267 tmp = format!("{}em", x);
268 &tmp
269 }
270 Length::Ratio(x) => {
271 tmp = format!("{:.0}%", x * 100.0);
272 &tmp
273 }
274 Length::Expr(expr) => {
275 match expr {
276 LengthExpr::Calc(calc_expr) => {
277 tmp = calc_expr.to_string();
278 &tmp
279 }
280 _ => "not support",
281 }
282 }
283 Length::Vmin(x) => {
284 tmp = format!("{}vmin", x);
285 &tmp
286 }
287 Length::Vmax(x) => {
288 tmp = format!("{}vmax", x);
289 &tmp
290 }
291 }
292 )
293 }
294}
295
296impl fmt::Display for Position {
297 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
298 write!(
299 f,
300 "{}",
301 match self {
302 Position::Static => "static",
303 Position::Relative => "relative",
304 Position::Absolute => "absolute",
305 Position::Fixed => "fixed",
306 Position::Sticky => "sticky",
307 }
308 )
309 }
310}
311impl fmt::Display for Angle {
312 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
313 write!(
314 f,
315 "{}",
316 match self {
317 Angle::Deg(x) => {
318 format!("{}deg", x)
319 }
320 Angle::Grad(x) => {
321 format!("{}grad", x)
322 }
323 Angle::Rad(x) => {
324 format!("{}rad", x)
325 }
326 Angle::Turn(x) => {
327 format!("{}turn", x)
328 }
329 Angle::Calc(expr) => expr.to_string(),
330 }
331 )
332 }
333}
334
335impl fmt::Display for Overflow {
336 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
337 write!(
338 f,
339 "{}",
340 match self {
341 Overflow::Visible => "visible",
342 Overflow::Hidden => "hidden",
343 Overflow::Auto => "auto",
344 Overflow::Scroll => "scroll",
345 }
346 )
347 }
348}
349impl fmt::Display for OverflowWrap {
350 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
351 write!(
352 f,
353 "{}",
354 match self {
355 OverflowWrap::Normal => "normal",
356 OverflowWrap::BreakWord => "break-word",
357 }
358 )
359 }
360}
361impl fmt::Display for PointerEvents {
362 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
363 write!(
364 f,
365 "{}",
366 match self {
367 PointerEvents::Auto => "auto",
368 PointerEvents::None => "none",
369 PointerEvents::WxRoot => "root",
370 }
371 )
372 }
373}
374impl fmt::Display for WxEngineTouchEvent {
375 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
376 write!(
377 f,
378 "{}",
379 match self {
380 WxEngineTouchEvent::Gesture => "gesture",
381 WxEngineTouchEvent::Click => "click",
382 WxEngineTouchEvent::None => "none",
383 }
384 )
385 }
386}
387impl fmt::Display for Visibility {
388 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
389 write!(
390 f,
391 "{}",
392 match self {
393 Visibility::Visible => "visible",
394 Visibility::Hidden => "hidden",
395 Visibility::Collapse => "collapse",
396 }
397 )
398 }
399}
400impl fmt::Display for FlexWrap {
401 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
402 write!(
403 f,
404 "{}",
405 match self {
406 FlexWrap::NoWrap => "nowrap",
407 FlexWrap::Wrap => "wrap",
408 FlexWrap::WrapReverse => "wrap-reverse",
409 }
410 )
411 }
412}
413impl fmt::Display for FlexDirection {
414 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
415 write!(
416 f,
417 "{}",
418 match self {
419 FlexDirection::Row => "row",
420 FlexDirection::RowReverse => "row-reverse",
421 FlexDirection::Column => "column",
422 FlexDirection::ColumnReverse => "column-reverse",
423 }
424 )
425 }
426}
427impl fmt::Display for Direction {
428 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
429 write!(
430 f,
431 "{}",
432 match self {
433 Direction::Auto => "auto",
434 Direction::LTR => "ltr",
435 Direction::RTL => "rtl",
436 }
437 )
438 }
439}
440impl fmt::Display for WritingMode {
441 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
442 write!(
443 f,
444 "{}",
445 match self {
446 WritingMode::HorizontalTb => "horizontal-tb",
447 WritingMode::VerticalLr => "vertical-lr",
448 WritingMode::VerticalRl => "vertical-rl",
449 }
450 )
451 }
452}
453impl fmt::Display for AlignItems {
454 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
455 write!(
456 f,
457 "{}",
458 match self {
459 AlignItems::Stretch => "stretch",
460 AlignItems::Normal => "normal",
461 AlignItems::Center => "center",
462 AlignItems::Start => "start",
463 AlignItems::End => "end",
464 AlignItems::FlexStart => "flex-start",
465 AlignItems::FlexEnd => "flex-end",
466 AlignItems::SelfStart => "self-start",
467 AlignItems::SelfEnd => "self-end",
468 AlignItems::Baseline => "baseline",
469 }
470 )
471 }
472}
473impl fmt::Display for AlignSelf {
474 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
475 write!(
476 f,
477 "{}",
478 match self {
479 AlignSelf::Auto => "auto",
480 AlignSelf::Normal => "normal",
481 AlignSelf::Stretch => "stretch",
482 AlignSelf::Center => "center",
483 AlignSelf::Start => "start",
484 AlignSelf::End => "end",
485 AlignSelf::SelfStart => "self-start",
486 AlignSelf::SelfEnd => "self-end",
487 AlignSelf::FlexStart => "flex-start",
488 AlignSelf::FlexEnd => "flex-end",
489 AlignSelf::Baseline => "baseline",
490 }
491 )
492 }
493}
494impl fmt::Display for AlignContent {
495 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
496 write!(
497 f,
498 "{}",
499 match self {
500 AlignContent::Normal => "normal",
501 AlignContent::Start => "start",
502 AlignContent::End => "end",
503 AlignContent::Stretch => "stretch",
504 AlignContent::Center => "center",
505 AlignContent::FlexStart => "flex-start",
506 AlignContent::FlexEnd => "flex-end",
507 AlignContent::SpaceBetween => "space-between",
508 AlignContent::SpaceAround => "space-around",
509 AlignContent::SpaceEvenly => "space-evenly",
510 AlignContent::Baseline => "baseline",
511 }
512 )
513 }
514}
515impl fmt::Display for JustifyContent {
516 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
517 write!(
518 f,
519 "{}",
520 match self {
521 JustifyContent::Center => "center",
522 JustifyContent::FlexStart => "flex-start",
523 JustifyContent::FlexEnd => "flex-end",
524 JustifyContent::SpaceBetween => "space-between",
525 JustifyContent::SpaceAround => "space-around",
526 JustifyContent::SpaceEvenly => "space-evenly",
527 JustifyContent::Start => "start",
528 JustifyContent::End => "end",
529 JustifyContent::Left => "left",
530 JustifyContent::Right => "right",
531 JustifyContent::Stretch => "stretch",
532 JustifyContent::Baseline => "baseline",
533 }
534 )
535 }
536}
537impl fmt::Display for JustifyItems {
538 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
539 write!(
540 f,
541 "{}",
542 match self {
543 JustifyItems::Stretch => "stretch",
544 JustifyItems::Center => "center",
545 JustifyItems::Start => "start",
546 JustifyItems::End => "end",
547 JustifyItems::FlexStart => "flex-start",
548 JustifyItems::FlexEnd => "flex-end",
549 JustifyItems::SelfStart => "self-start",
550 JustifyItems::SelfEnd => "self-end",
551 JustifyItems::Left => "left",
552 JustifyItems::Right => "right",
553 }
554 )
555 }
556}
557impl fmt::Display for TextAlign {
558 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
559 write!(
560 f,
561 "{}",
562 match self {
563 TextAlign::Left => "left",
564 TextAlign::Center => "center",
565 TextAlign::Right => "right",
566 TextAlign::Justify => "justify",
567 TextAlign::JustifyAll => "justify-all",
568 TextAlign::Start => "start",
569 TextAlign::End => "end",
570 TextAlign::MatchParent => "match-parent",
571 }
572 )
573 }
574}
575impl fmt::Display for FontWeight {
576 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
577 let x;
578 write!(
579 f,
580 "{}",
581 match self {
582 FontWeight::Normal => "normal",
583 FontWeight::Bold => "bold",
584 FontWeight::Bolder => "bolder",
585 FontWeight::Lighter => "lighter",
586 FontWeight::Num(a) => {
587 x = a.to_string();
588 &x
589 }
590 }
591 )
592 }
593}
594impl fmt::Display for WordBreak {
595 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
596 write!(
597 f,
598 "{}",
599 match self {
600 WordBreak::BreakWord => "break-word",
601 WordBreak::BreakAll => "break-all",
602 WordBreak::KeepAll => "keep-all",
603 }
604 )
605 }
606}
607
608impl fmt::Display for WhiteSpace {
609 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
610 write!(
611 f,
612 "{}",
613 match self {
614 WhiteSpace::Normal => "normal",
615 WhiteSpace::NoWrap => "nowrap",
616 WhiteSpace::Pre => "pre",
617 WhiteSpace::PreWrap => "pre-wrap",
618 WhiteSpace::PreLine => "pre-line",
619 WhiteSpace::WxPreEdit => "-wx-pre-edit",
620 }
621 )
622 }
623}
624
625impl fmt::Display for TextOverflow {
626 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
627 write!(
628 f,
629 "{}",
630 match self {
631 TextOverflow::Clip => "clip",
632 TextOverflow::Ellipsis => "ellipsis",
633 }
634 )
635 }
636}
637impl fmt::Display for VerticalAlign {
638 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
639 write!(
640 f,
641 "{}",
642 match self {
643 VerticalAlign::Baseline => "baseline",
644 VerticalAlign::Top => "top",
645 VerticalAlign::Middle => "middle",
646 VerticalAlign::Bottom => "bottom",
647 VerticalAlign::TextTop => "text-top",
648 VerticalAlign::TextBottom => "text-bottom",
649 }
650 )
651 }
652}
653impl fmt::Display for LineHeight {
654 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
655 let x;
656 write!(
657 f,
658 "{}",
659 match self {
660 LineHeight::Normal => "normal",
661 LineHeight::Length(a) => {
662 x = a.to_string();
663 &x
664 }
665 LineHeight::Num(a) => {
666 x = a.to_string();
667 &x
668 }
669 }
670 )
671 }
672}
673impl fmt::Display for FontFamily {
674 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
675 let mut str: String = String::new();
676 write!(
677 f,
678 "{}",
679 match self {
680 FontFamily::Names(array) => {
681 for index in 0..array.len() {
682 str.push_str(&array[index].to_string());
683 if index + 1 < array.len() {
684 str.push_str(", ");
685 }
686 }
687 &str
688 }
689 }
690 )
691 }
692}
693impl fmt::Display for FontFamilyName {
694 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
695 let str: String;
696 write!(
697 f,
698 "{}",
699 match self {
700 FontFamilyName::Serif => "serif",
701 FontFamilyName::SansSerif => "sans-serif",
702 FontFamilyName::Monospace => "monospace",
703 FontFamilyName::Cursive => "cursive",
704 FontFamilyName::Fantasy => "fantasy",
705 FontFamilyName::Title(a) => {
706 str = format!("\"{}\"", a.to_string());
707 &str
708 }
709 FontFamilyName::SystemUi => "system-ui",
710 }
711 )
712 }
713}
714impl fmt::Display for BoxSizing {
715 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
716 write!(
717 f,
718 "{}",
719 match self {
720 BoxSizing::ContentBox => "content-box",
721 BoxSizing::PaddingBox => "padding-box",
722 BoxSizing::BorderBox => "border-box",
723 }
724 )
725 }
726}
727impl fmt::Display for BorderStyle {
728 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
729 write!(
730 f,
731 "{}",
732 match self {
733 BorderStyle::None => "none",
734 BorderStyle::Solid => "solid",
735 BorderStyle::Dotted => "dotted",
736 BorderStyle::Dashed => "dashed",
737 BorderStyle::Hidden => "hidden",
738 BorderStyle::Double => "double",
739 BorderStyle::Groove => "groove",
740 BorderStyle::Ridge => "ridge",
741 BorderStyle::Inset => "inset",
742 BorderStyle::Outset => "outset",
743 }
744 )
745 }
746}
747impl fmt::Display for Transform {
748 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
749 let mut str = String::new();
750 write!(
751 f,
752 "{}",
753 match self {
754 Transform::Series(array) => {
755 for index in 0..array.len() {
756 str.push_str(&array[index].to_string());
757 if index + 1 < array.len() {
758 str.push(' ');
759 }
760 }
761 &str
762 }
763 }
764 )
765 }
766}
767impl fmt::Display for TransformItem {
768 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
769 let mut str = String::new();
770 write!(
771 f,
772 "{}",
773 match self {
774 TransformItem::None => "none",
775 TransformItem::Matrix(array) => {
776 for index in 0..array.len() {
777 str.push_str(&array[index].to_string());
778 if index + 1 < array.len() {
779 str.push_str(", ");
780 }
781 }
782 str = format!("matrix({})", &str);
783 &str
784 }
785 TransformItem::Matrix3D(array) => {
786 for index in 0..array.len() {
787 str.push_str(&array[index].to_string());
788 if index + 1 < array.len() {
789 str.push_str(", ");
790 }
791 }
792 str = format!("matrix3d({})", &str);
793 &str
794 }
795 TransformItem::Translate2D(x, y) => {
796 str = format!("translate({}, {})", x, y);
797 &str
798 }
799 TransformItem::Translate3D(x, y, z) => {
800 str = format!("translate3d({}, {}, {})", x, y, z);
801 &str
802 }
803 TransformItem::Scale2D(x, y) => {
804 str = format!("scale({}, {})", x, y);
805 &str
806 }
807 TransformItem::Scale3D(x, y, z) => {
808 str = format!("scale3d({}, {}, {})", x, y, z);
809 &str
810 }
811 TransformItem::Rotate2D(x) => {
812 str = format!("rotate({})", x);
813 &str
814 }
815 TransformItem::Rotate3D(x, y, z, deg) => {
816 str = format!("rotate3d({}, {}, {}, {})", x, y, z, deg);
817 &str
818 }
819 TransformItem::Skew(x, y) => {
820 str = format!("skew({}, {})", x, y);
821 &str
822 }
823 TransformItem::Perspective(x) => {
824 str = format!("perspective({})", x);
825 &str
826 }
827 }
828 )
829 }
830}
831
832impl fmt::Display for TransitionProperty {
833 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
834 let mut str = String::new();
835 write!(
836 f,
837 "{}",
838 match self {
839 TransitionProperty::List(array) => {
840 for index in 0..array.len() {
841 str.push_str(&array[index].to_string());
842 if index + 1 < array.len() {
843 str.push_str(", ");
844 }
845 }
846 &str
847 }
848 }
849 )
850 }
851}
852impl fmt::Display for TransitionPropertyItem {
853 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
854 write!(
855 f,
856 "{}",
857 match self {
858 TransitionPropertyItem::None => "none",
859 TransitionPropertyItem::Transform => "transform",
860 TransitionPropertyItem::TransformOrigin => "transform-origin",
861 TransitionPropertyItem::LineHeight => "line-height",
862 TransitionPropertyItem::Opacity => "opacity",
863 TransitionPropertyItem::All => "all",
864 TransitionPropertyItem::Height => "height",
865 TransitionPropertyItem::Width => "width",
866 TransitionPropertyItem::MinHeight => "min-height",
867 TransitionPropertyItem::MaxHeight => "max-height",
868 TransitionPropertyItem::MinWidth => "min-width",
869 TransitionPropertyItem::MaxWidth => "max-width",
870 TransitionPropertyItem::MarginTop => "margin-top",
871 TransitionPropertyItem::MarginRight => "margin-right",
872 TransitionPropertyItem::MarginLeft => "margin-left",
873 TransitionPropertyItem::MarginBottom => "margin-bottom",
874 TransitionPropertyItem::Margin => "margin",
875 TransitionPropertyItem::PaddingTop => "padding-top",
876 TransitionPropertyItem::PaddingRight => "padding-right",
877 TransitionPropertyItem::PaddingBottom => "padding-bottom",
878 TransitionPropertyItem::PaddingLeft => "padding-left",
879 TransitionPropertyItem::Padding => "padding",
880 TransitionPropertyItem::Top => "top",
881 TransitionPropertyItem::Right => "right",
882 TransitionPropertyItem::Bottom => "bottom",
883 TransitionPropertyItem::Left => "left",
884 TransitionPropertyItem::FlexGrow => "flex-grow",
885 TransitionPropertyItem::FlexShrink => "flex-shrink",
886 TransitionPropertyItem::FlexBasis => "flex-basis",
887 TransitionPropertyItem::Flex => "flex",
888 TransitionPropertyItem::BorderTopWidth => "border-top-width",
889 TransitionPropertyItem::BorderRightWidth => "border-right-width",
890 TransitionPropertyItem::BorderBottomWidth => "border-bottom-width",
891 TransitionPropertyItem::BorderLeftWidth => "border-left-width",
892 TransitionPropertyItem::BorderTopColor => "border-top-color",
893 TransitionPropertyItem::BorderRightColor => "border-right-color",
894 TransitionPropertyItem::BorderBottomColor => "border-bottom-color",
895 TransitionPropertyItem::BorderLeftColor => "border-left-color",
896 TransitionPropertyItem::BorderTopLeftRadius => "border-top-left-radius",
897 TransitionPropertyItem::BorderTopRightRadius => "border-top-right-radius",
898 TransitionPropertyItem::BorderBottomLeftRadius => "border-bottom-left-radius",
899 TransitionPropertyItem::BorderBottomRightRadius => "border-bottom-right-radius",
900 TransitionPropertyItem::Border => "border",
901 TransitionPropertyItem::BorderWidth => "border-width",
902 TransitionPropertyItem::BorderColor => "border-color",
903 TransitionPropertyItem::BorderRadius => "border-radius",
904 TransitionPropertyItem::BorderLeft => "border-left",
905 TransitionPropertyItem::BorderTop => "border-top",
906 TransitionPropertyItem::BorderRight => "border-right",
907 TransitionPropertyItem::BorderBottom => "border-bottom",
908 TransitionPropertyItem::Font => "font",
909 TransitionPropertyItem::ZIndex => "z-index",
910 TransitionPropertyItem::BoxShadow => "box-shadow",
911 TransitionPropertyItem::BackdropFilter => "backdrop-filter",
912 TransitionPropertyItem::Filter => "filter",
913 TransitionPropertyItem::Color => "color",
914 TransitionPropertyItem::TextDecorationColor => "text-decoration-color",
915 TransitionPropertyItem::TextDecorationThickness => "text-decoration-thickness",
916 TransitionPropertyItem::FontSize => "font-size",
917 TransitionPropertyItem::FontWeight => "font-weight",
918 TransitionPropertyItem::LetterSpacing => "letter-spacing",
919 TransitionPropertyItem::WordSpacing => "word-spacing",
920 TransitionPropertyItem::BackgroundColor => "background-color",
921 TransitionPropertyItem::BackgroundPosition => "background-position",
922 TransitionPropertyItem::BackgroundSize => "background-size",
923 TransitionPropertyItem::Background => "background",
924 TransitionPropertyItem::BackgroundPositionX => "background-position-x",
925 TransitionPropertyItem::BackgroundPositionY => "background-position-y",
926 TransitionPropertyItem::MaskPosition => "mask-position",
927 TransitionPropertyItem::MaskPositionX => "mask-position-x",
928 TransitionPropertyItem::MaskPositionY => "mask-position-y",
929 TransitionPropertyItem::MaskSize => "mask-size",
930 TransitionPropertyItem::Mask => "mask",
931 }
932 )
933 }
934}
935
936impl fmt::Display for StepPosition {
937 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
938 write!(
939 f,
940 "{}",
941 match self {
942 StepPosition::End => "end",
943 StepPosition::JumpStart => "jump-start",
944 StepPosition::JumpEnd => "jump-end",
945 StepPosition::JumpNone => "jump-none",
946 StepPosition::JumpBoth => "jump-both",
947 StepPosition::Start => "start",
948 }
949 )
950 }
951}
952
953impl fmt::Display for TransitionTime {
954 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
955 let mut str = String::new();
956 write!(
957 f,
958 "{}",
959 match self {
960 TransitionTime::List(array) => {
961 for index in 0..array.len() {
962 if array[index] >= 1000 {
963 let s: u32 = array[index] / 1000;
964 str.push_str(&s.to_string());
965 str.push('s');
966 } else {
967 str.push_str(&array[index].to_string());
968 str.push_str("ms");
969 }
970
971 if index + 1 < array.len() {
972 str.push_str(", ");
973 }
974 }
975 &str
976 }
977 TransitionTime::ListI32(array) => {
978 for index in 0..array.len() {
979 if array[index] >= 1000 {
980 let s: i32 = array[index] / 1000;
981 str.push_str(&s.to_string());
982 str.push('s');
983 } else {
984 str.push_str(&array[index].to_string());
985 str.push_str("ms");
986 }
987
988 if index + 1 < array.len() {
989 str.push_str(", ");
990 }
991 }
992 &str
993 }
994 }
995 )
996 }
997}
998
999impl fmt::Display for TransitionTimingFn {
1000 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1001 let mut str = String::new();
1002 write!(
1003 f,
1004 "{}",
1005 match self {
1006 TransitionTimingFn::List(array) => {
1007 for index in 0..array.len() {
1008 str.push_str(&array[index].to_string());
1009 if index + 1 < array.len() {
1010 str.push_str(", ");
1011 }
1012 }
1013 &str
1014 }
1015 }
1016 )
1017 }
1018}
1019impl fmt::Display for TransitionTimingFnItem {
1020 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1021 let str;
1022 write!(
1023 f,
1024 "{}",
1025 match self {
1026 TransitionTimingFnItem::Linear => "linear",
1027 TransitionTimingFnItem::Ease => "ease",
1028 TransitionTimingFnItem::EaseIn => "ease-in",
1029 TransitionTimingFnItem::EaseOut => "ease-out",
1030 TransitionTimingFnItem::EaseInOut => "ease-in-out",
1031 TransitionTimingFnItem::StepStart => "step-start",
1032 TransitionTimingFnItem::StepEnd => "step-end",
1033 TransitionTimingFnItem::Steps(x, y) => {
1034 str = format!("steps({}, {})", x, y);
1035 &str
1036 }
1037 TransitionTimingFnItem::CubicBezier(x, y, z, a) => {
1038 str = format!("cubic-bezier({}, {}, {}, {})", x, y, z, a);
1039 &str
1040 }
1041 }
1042 )
1043 }
1044}
1045
1046impl fmt::Display for Scrollbar {
1047 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1048 write!(
1049 f,
1050 "{}",
1051 match self {
1052 Scrollbar::Auto => "auto",
1053 Scrollbar::Hidden => "hidden",
1054 Scrollbar::AutoHide => "auto-hide",
1055 Scrollbar::AlwaysShow => "always-show",
1056 }
1057 )
1058 }
1059}
1060
1061impl fmt::Display for BackgroundRepeat {
1062 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1063 let mut str = String::new();
1064 write!(
1065 f,
1066 "{}",
1067 match self {
1068 BackgroundRepeat::List(array) => {
1069 for index in 0..array.len() {
1070 str.push_str(&array[index].to_string());
1071 if index + 1 < array.len() {
1072 str.push_str(", ");
1073 }
1074 }
1075 &str
1076 }
1077 }
1078 )
1079 }
1080}
1081impl fmt::Display for BackgroundRepeatItem {
1082 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1083 let str;
1084 write!(
1085 f,
1086 "{}",
1087 match self {
1088 BackgroundRepeatItem::Pos(x, y) => {
1089 str = format!("{} {}", x, y);
1090 &str
1091 }
1092 }
1093 )
1094 }
1095}
1096impl fmt::Display for BackgroundRepeatValue {
1097 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1098 write!(
1099 f,
1100 "{}",
1101 match self {
1102 BackgroundRepeatValue::Repeat => "repeat",
1103 BackgroundRepeatValue::NoRepeat => "no-repeat",
1104 BackgroundRepeatValue::Space => "space",
1105 BackgroundRepeatValue::Round => "round",
1106 }
1107 )
1108 }
1109}
1110
1111impl fmt::Display for BackgroundSize {
1112 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1113 let mut str = String::new();
1114 write!(
1115 f,
1116 "{}",
1117 match self {
1118 BackgroundSize::List(array) => {
1119 for index in 0..array.len() {
1120 str.push_str(&array[index].to_string());
1121 if index + 1 < array.len() {
1122 str.push_str(", ");
1123 }
1124 }
1125 &str
1126 }
1127 }
1128 )
1129 }
1130}
1131impl fmt::Display for BackgroundSizeItem {
1132 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1133 let str;
1134 write!(
1135 f,
1136 "{}",
1137 match self {
1138 BackgroundSizeItem::Auto => "auto",
1139 BackgroundSizeItem::Length(x, y) => {
1140 str = format!("{} {}", x, y);
1141 &str
1142 }
1143 BackgroundSizeItem::Cover => "cover",
1144 BackgroundSizeItem::Contain => "contain",
1145 }
1146 )
1147 }
1148}
1149impl fmt::Display for BackgroundImage {
1150 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1151 let mut str = String::new();
1152 write!(
1153 f,
1154 "{}",
1155 match self {
1156 BackgroundImage::List(array) => {
1157 for index in 0..array.len() {
1158 str.push_str(&array[index].to_string());
1159 if index + 1 < array.len() {
1160 str.push_str(", ");
1161 }
1162 }
1163 &str
1164 }
1165 }
1166 )
1167 }
1168}
1169impl fmt::Display for ImageTags {
1170 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1171 write!(
1172 f,
1173 "{}",
1174 match self {
1175 ImageTags::LTR => "ltr",
1176 ImageTags::RTL => "rtl",
1177 }
1178 )
1179 }
1180}
1181impl fmt::Display for ImageSource {
1182 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1183 let str;
1184 write!(
1185 f,
1186 "{}",
1187 match self {
1188 ImageSource::None => "none",
1189 ImageSource::Url(x) => {
1190 str = format!("url({})", x.to_string());
1191 &str
1192 }
1193 }
1194 )
1195 }
1196}
1197impl fmt::Display for BackgroundImageItem {
1198 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1199 let mut tmp;
1200 write!(
1201 f,
1202 "{}",
1203 match self {
1204 BackgroundImageItem::None => "none",
1205 BackgroundImageItem::Url(x) => {
1206 tmp = format!("url(\"{}\")", x.to_string());
1207 &tmp
1208 }
1209 BackgroundImageItem::Gradient(x) => {
1210 tmp = x.to_string();
1211 &tmp
1212 }
1213 BackgroundImageItem::Image(x, y, z) => {
1214 tmp = String::from("image(");
1215 if *x != ImageTags::LTR {
1217 tmp.push_str(&x.to_string());
1218 tmp.push(' ');
1219 }
1220
1221 if *y != ImageSource::None {
1222 tmp.push_str(&y.to_string());
1223 }
1224 if *z != Color::Undefined {
1225 tmp.push_str(", ");
1226 tmp.push_str(&z.to_string());
1227 }
1228 tmp.push(')');
1229 &tmp
1230 }
1231 BackgroundImageItem::Element(x) => {
1232 tmp = format!("element(#{})", x.to_string());
1233 &tmp
1234 }
1235 }
1236 )
1237 }
1238}
1239impl fmt::Display for BackgroundImageGradientItem {
1240 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1241 let mut str = String::new();
1242 write!(
1243 f,
1244 "{}",
1245 match self {
1246 BackgroundImageGradientItem::LinearGradient(x, array) => {
1247 str.push_str("linear-gradient(");
1248 if *x != Angle::Deg(180.0) {
1250 str.push_str(&x.to_string());
1251 str.push_str(", ");
1252 }
1253 str.push_str(&generate_array_str(array));
1254 str.push(')');
1255 &str
1256 }
1257 BackgroundImageGradientItem::RadialGradient(x, y, z, array) => {
1258 str = generate_array_str(array);
1259 str = format!("radial-gradient({} {} at {}, {})", x, y, z, str);
1260 &str
1261 }
1262 BackgroundImageGradientItem::ConicGradient(gradient) => {
1263 str = format!(
1264 "conic-gradient(from {} at {}, {})",
1265 gradient.angle,
1266 gradient.position,
1267 generate_array_str(&gradient.items)
1268 );
1269 &str
1270 }
1271 }
1272 )
1273 }
1274}
1275
1276impl fmt::Display for GradientSize {
1277 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1278 let tmp;
1279 write!(
1280 f,
1281 "{}",
1282 match self {
1283 GradientSize::ClosestSide => "closest-side",
1284 GradientSize::ClosestCorner => "closest-corner",
1285 GradientSize::FarthestSide => "farthest-side",
1286 GradientSize::FarthestCorner => "farthest-corner",
1287 GradientSize::Len(x, y) => {
1288 tmp = format!("{} {}", x, y);
1289 &tmp
1290 }
1291 }
1292 )
1293 }
1294}
1295impl fmt::Display for GradientPosition {
1296 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1297 let tmp;
1298 write!(
1301 f,
1302 "{}",
1303 match self {
1304 GradientPosition::Pos(x, y) => {
1305 let horizontal_str = match x {
1306 y if *y == Length::Ratio(0.5) => "center".to_string(),
1307 y if *y == Length::Ratio(0.0) => "left".to_string(),
1308 y if *y == Length::Ratio(1.0) => "right".to_string(),
1309 x => x.to_string(),
1310 };
1311 let vertical_str = match y {
1312 n if *n == Length::Ratio(0.5) => "center".to_string(),
1313 n if *n == Length::Ratio(0.0) => "top".to_string(),
1314 n if *n == Length::Ratio(1.0) => "bottom".to_string(),
1315 y => y.to_string(),
1316 };
1317
1318 if horizontal_str == vertical_str {
1319 "center"
1320 } else {
1321 tmp = format!("{} {}", horizontal_str, vertical_str);
1322 &tmp
1323 }
1324 }
1325 }
1326 )
1327 }
1328}
1329impl fmt::Display for GradientShape {
1330 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1331 write!(
1332 f,
1333 "{}",
1334 match self {
1335 GradientShape::Ellipse => "ellipse",
1336 GradientShape::Circle => "circle",
1337 }
1338 )
1339 }
1340}
1341impl fmt::Display for GradientColorItem {
1342 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1343 let mut tmp = String::new();
1344 write!(
1345 f,
1346 "{}",
1347 match self {
1348 GradientColorItem::ColorHint(color, len) => {
1349 tmp.push_str(&color.to_string());
1350 if *len != Length::Auto {
1352 tmp.push(' ');
1353 tmp.push_str(&len.to_string());
1354 }
1355 &tmp
1356 }
1357 GradientColorItem::SimpleColorHint(color) => {
1358 tmp.push_str(&color.to_string());
1359 &tmp
1360 }
1361 GradientColorItem::AngleOrPercentageColorHint(color, angle_or_percentage) => {
1362 tmp.push_str(&color.to_string());
1363 tmp.push(' ');
1364 match angle_or_percentage {
1365 AngleOrPercentage::Angle(angle) => {
1366 tmp.push_str(&angle.to_string());
1367 }
1368 AngleOrPercentage::Percentage(percentage) => {
1369 tmp.push_str(&percentage.to_string());
1370 }
1371 }
1372 &tmp
1373 }
1374 }
1375 )
1376 }
1377}
1378impl fmt::Display for BackgroundPosition {
1379 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1380 let mut x = String::new();
1381 write!(
1382 f,
1383 "{}",
1384 match self {
1385 BackgroundPosition::List(items) => {
1386 for index in 0..items.len() {
1387 x.push_str(&items[index].to_string());
1388 if index < items.len() - 1 {
1389 x.push_str(", ");
1390 }
1391 }
1392 &x
1393 }
1394 }
1395 )
1396 }
1397}
1398impl fmt::Display for BackgroundPositionItem {
1399 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1400 let mut str = String::new();
1401 write!(
1402 f,
1403 "{}",
1404 match self {
1405 BackgroundPositionItem::Pos(x, y) => {
1406 let horizontal_str = &x.to_string();
1407 let vertical_str = &y.to_string();
1408 if *horizontal_str == "center" && *vertical_str == "center" {
1409 str.push_str("center");
1410 } else if vertical_str == "center" {
1411 str.push_str(horizontal_str);
1412 } else {
1413 str = format!("{} {}", horizontal_str, vertical_str);
1414 }
1415 &str
1416 }
1417 BackgroundPositionItem::Value(v) => {
1418 str = v.to_string();
1419 &str
1420 }
1421 }
1422 )
1423 }
1424}
1425impl fmt::Display for BackgroundPositionValue {
1426 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1427 let mut x = String::new();
1428 write!(
1429 f,
1430 "{}",
1431 match self {
1432 BackgroundPositionValue::Top(top) => {
1433 match top {
1434 n if *n == Length::Ratio(0.) => {
1435 x.push_str("top");
1436 }
1437 n if *n == Length::Ratio(1.) => {
1438 x.push_str("bottom");
1439 }
1440 n if *n == Length::Ratio(0.5) => {
1441 x.push_str("center");
1442 }
1443 Length::Ratio(ratio) => x.push_str(&Length::Ratio(*ratio).to_string()),
1445 other => {
1446 x = format!("{} {}", "top", &other.to_string());
1447 }
1448 }
1449 &x
1450 }
1451 BackgroundPositionValue::Bottom(bottom) => {
1452 match bottom {
1453 n if *n == Length::Ratio(0.) => {
1454 x.push_str("bottom");
1455 }
1456 n if *n == Length::Ratio(1.) => {
1457 x.push_str("top");
1458 }
1459 n if *n == Length::Ratio(0.5) => {
1460 x.push_str("center");
1461 }
1462 other => {
1463 x = format!("{} {}", "bottom", &other.to_string());
1464 }
1465 }
1466 &x
1467 }
1468 BackgroundPositionValue::Left(left) => {
1469 match left {
1470 n if *n == Length::Ratio(0.) => {
1471 x.push_str("left");
1472 }
1473 n if *n == Length::Ratio(1.) => {
1474 x.push_str("right");
1475 }
1476 n if *n == Length::Ratio(0.5) => {
1477 x.push_str("center");
1478 }
1479 Length::Ratio(ratio) => x.push_str(&Length::Ratio(*ratio).to_string()),
1481 other => {
1482 x = format!("{} {}", "left", &other.to_string());
1483 }
1484 }
1485 &x
1486 }
1487 BackgroundPositionValue::Right(right) => {
1488 match right {
1489 n if *n == Length::Ratio(0.) => {
1490 x.push_str("right");
1491 }
1492 n if *n == Length::Ratio(1.) => {
1493 x.push_str("left");
1494 }
1495 n if *n == Length::Ratio(0.5) => {
1496 x.push_str("center");
1497 }
1498 other => {
1499 x = format!("{} {}", "right", &other.to_string());
1500 }
1501 }
1502 &x
1503 }
1504 }
1505 )
1506 }
1507}
1508impl fmt::Display for FontStyle {
1509 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1510 let mut x = String::new();
1511 write!(
1512 f,
1513 "{}",
1514 match self {
1515 FontStyle::Normal => "normal",
1516 FontStyle::Italic => "italic",
1517 FontStyle::Oblique(a) => {
1518 x.push_str("oblique");
1519 if *a != Angle::Deg(14.) {
1520 x.push(' ');
1521 x.push_str(&a.to_string());
1522 }
1523 &x
1524 }
1525 }
1526 )
1527 }
1528}
1529impl fmt::Display for BackgroundClip {
1530 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1531 let mut str = String::new();
1532 write!(
1533 f,
1534 "{}",
1535 match self {
1536 BackgroundClip::List(items) => {
1537 for index in 0..items.len() {
1538 str.push_str(&items[index].to_string());
1539 if index < items.len() - 1 {
1540 str.push_str(", ")
1541 }
1542 }
1543 &str
1544 }
1545 }
1546 )
1547 }
1548}
1549
1550impl fmt::Display for BackgroundClipItem {
1551 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1552 write!(
1553 f,
1554 "{}",
1555 match self {
1556 BackgroundClipItem::BorderBox => "border-box",
1557 BackgroundClipItem::PaddingBox => "padding-box",
1558 BackgroundClipItem::ContentBox => "content-box",
1559 BackgroundClipItem::Text => "text",
1560 }
1561 )
1562 }
1563}
1564
1565impl fmt::Display for BackgroundOrigin {
1566 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1567 let mut str = String::new();
1568 write!(
1569 f,
1570 "{}",
1571 match self {
1572 BackgroundOrigin::List(items) => {
1573 for index in 0..items.len() {
1574 str.push_str(&items[index].to_string());
1575 if index < items.len() - 1 {
1576 str.push_str(", ")
1577 }
1578 }
1579 &str
1580 }
1581 }
1582 )
1583 }
1584}
1585impl fmt::Display for BackgroundOriginItem {
1586 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1587 write!(
1588 f,
1589 "{}",
1590 match self {
1591 BackgroundOriginItem::BorderBox => "border-box",
1592 BackgroundOriginItem::PaddingBox => "padding-box",
1593 BackgroundOriginItem::ContentBox => "content-box",
1594 }
1595 )
1596 }
1597}
1598impl fmt::Display for BackgroundAttachmentItem {
1599 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1600 write!(
1601 f,
1602 "{}",
1603 match self {
1604 BackgroundAttachmentItem::Scroll => "scroll",
1605 BackgroundAttachmentItem::Fixed => "fixed",
1606 BackgroundAttachmentItem::Local => "local",
1607 }
1608 )
1609 }
1610}
1611impl fmt::Display for BackgroundAttachment {
1612 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1613 let mut str = String::new();
1614 write!(
1615 f,
1616 "{}",
1617 match self {
1618 BackgroundAttachment::List(items) => {
1619 for index in 0..items.len() {
1620 str.push_str(&items[index].to_string());
1621 if index < items.len() - 1 {
1622 str.push_str(", ")
1623 }
1624 }
1625 &str
1626 }
1627 }
1628 )
1629 }
1630}
1631impl fmt::Display for Float {
1632 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1633 write!(
1634 f,
1635 "{}",
1636 match self {
1637 Float::None => "none",
1638 Float::Left => "left",
1639 Float::Right => "right",
1640 Float::InlineStart => "inline-start",
1641 Float::InlineEnd => "inline-end",
1642 }
1643 )
1644 }
1645}
1646impl fmt::Display for ListStyleType {
1647 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1648 let x;
1649 write!(
1650 f,
1651 "{}",
1652 match self {
1653 ListStyleType::Disc => "disc",
1654 ListStyleType::None => "none",
1655 ListStyleType::Circle => "circle",
1656 ListStyleType::Square => "square",
1657 ListStyleType::Decimal => "decimal",
1658 ListStyleType::CjkDecimal => "cjk-decimal",
1659 ListStyleType::DecimalLeadingZero => "decimal-leading-zero",
1660 ListStyleType::LowerRoman => "lower-roman",
1661 ListStyleType::UpperRoman => "upper-roman",
1662 ListStyleType::LowerGreek => "lower-greek",
1663 ListStyleType::LowerAlpha => "lower-alpha",
1664 ListStyleType::LowerLatin => "lower-latin",
1665 ListStyleType::UpperAlpha => "upper-alpha",
1666 ListStyleType::UpperLatin => "upper-latin",
1667 ListStyleType::Armenian => "armenian",
1668 ListStyleType::Georgian => "georgian",
1669 ListStyleType::CustomIdent(str) => {
1670 x = str.to_string();
1671 &x
1672 }
1673 }
1674 )
1675 }
1676}
1677impl fmt::Display for ListStyleImage {
1678 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1679 let str;
1680 write!(
1681 f,
1682 "{}",
1683 match self {
1684 ListStyleImage::None => "none",
1685 ListStyleImage::Url(x) => {
1686 str = format!("url({})", x.to_string());
1687 &str
1688 }
1689 }
1690 )
1691 }
1692}
1693impl fmt::Display for ListStylePosition {
1694 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1695 write!(
1696 f,
1697 "{}",
1698 match self {
1699 ListStylePosition::Outside => "outside",
1700 ListStylePosition::Inside => "inside",
1701 }
1702 )
1703 }
1704}
1705impl fmt::Display for Resize {
1706 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1707 write!(
1708 f,
1709 "{}",
1710 match self {
1711 Resize::None => "none",
1712 Resize::Both => "both",
1713 Resize::Horizontal => "horizontal",
1714 Resize::Vertical => "vertical",
1715 Resize::Block => "block",
1716 Resize::Inline => "inline",
1717 }
1718 )
1719 }
1720}
1721impl fmt::Display for ZIndex {
1722 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1723 let x;
1724 write!(
1725 f,
1726 "{}",
1727 match self {
1728 ZIndex::Auto => "auto",
1729 ZIndex::Num(a) => {
1730 x = format!("{}", a);
1731 &x
1732 }
1733 }
1734 )
1735 }
1736}
1737impl fmt::Display for TextShadow {
1738 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1739 let mut str = String::new();
1740 write!(
1741 f,
1742 "{}",
1743 match self {
1744 TextShadow::None => "none",
1745 TextShadow::List(items) => {
1746 for index in 0..items.len() {
1747 str.push_str(&items[index].to_string());
1748 if index < items.len() - 1 {
1749 str.push_str(", ")
1750 }
1751 }
1752 &str
1753 }
1754 }
1755 )
1756 }
1757}
1758impl fmt::Display for TextShadowItem {
1759 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1760 let mut tmp = String::new();
1761 write!(
1762 f,
1763 "{}",
1764 match self {
1765 TextShadowItem::TextShadowValue(offsety, offsetx, blurradius, color) => {
1766 if *offsety != Length::Px(0.) {
1767 tmp.push_str(&offsety.to_string());
1768 }
1769 if *offsetx != Length::Px(0.) {
1770 tmp.push(' ');
1771 tmp.push_str(&offsetx.to_string());
1772 }
1773 if *blurradius != Length::Px(0.) && *blurradius != Length::Undefined {
1774 tmp.push(' ');
1775 tmp.push_str(&blurradius.to_string());
1776 }
1777 if *color != Color::Undefined {
1778 tmp.push(' ');
1779 tmp.push_str(&color.to_string());
1780 }
1781 &tmp
1782 }
1783 }
1784 )
1785 }
1786}
1787impl fmt::Display for TextDecorationLine {
1788 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1789 let mut str = String::new();
1790 write!(
1791 f,
1792 "{}",
1793 match self {
1794 TextDecorationLine::None => "none",
1795 TextDecorationLine::SpellingError => "spelling-error",
1796 TextDecorationLine::GrammarError => "grammar-error",
1797 TextDecorationLine::List(array) => {
1798 for index in 0..array.len() {
1799 str.push_str(&array[index].to_string());
1800 if index + 1 < array.len() {
1801 str.push(' ');
1802 }
1803 }
1804 &str
1805 }
1806 }
1807 )
1808 }
1809}
1810
1811impl fmt::Display for TextDecorationLineItem {
1812 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1813 write!(
1814 f,
1815 "{}",
1816 match self {
1817 TextDecorationLineItem::Overline => "overline",
1818 TextDecorationLineItem::LineThrough => "line-through",
1819 TextDecorationLineItem::Underline => "underline",
1820 TextDecorationLineItem::Blink => "blink",
1821 }
1822 )
1823 }
1824}
1825impl fmt::Display for TextDecorationStyle {
1826 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1827 write!(
1828 f,
1829 "{}",
1830 match self {
1831 TextDecorationStyle::Solid => "solid",
1832 TextDecorationStyle::Double => "double",
1833 TextDecorationStyle::Dotted => "dotted",
1834 TextDecorationStyle::Dashed => "dashed",
1835 TextDecorationStyle::Wavy => "wavy",
1836 }
1837 )
1838 }
1839}
1840impl fmt::Display for TextDecorationThickness {
1841 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1842 let x;
1843 write!(
1844 f,
1845 "{}",
1846 match self {
1847 TextDecorationThickness::Auto => "auto",
1848 TextDecorationThickness::FromFont => "from-font",
1849 TextDecorationThickness::Length(len) => {
1850 x = len.to_string();
1851 &x
1852 }
1853 }
1854 )
1855 }
1856}
1857impl fmt::Display for LetterSpacing {
1858 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1859 let x;
1860 write!(
1861 f,
1862 "{}",
1863 match self {
1864 LetterSpacing::Normal => "normal",
1865 LetterSpacing::Length(len) => {
1866 x = len.to_string();
1867 &x
1868 }
1869 }
1870 )
1871 }
1872}
1873impl fmt::Display for WordSpacing {
1874 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1875 let x;
1876 write!(
1877 f,
1878 "{}",
1879 match self {
1880 WordSpacing::Normal => "normal",
1881 WordSpacing::Length(len) => {
1882 x = len.to_string();
1883 &x
1884 }
1885 }
1886 )
1887 }
1888}
1889impl fmt::Display for BorderRadius {
1890 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1891 let tmp;
1892 write!(
1893 f,
1894 "{}",
1895 match self {
1896 BorderRadius::Pos(x, y) => {
1897 tmp = format!("{} {}", x, y);
1898 &tmp
1899 }
1900 }
1901 )
1902 }
1903}
1904impl fmt::Display for BoxShadow {
1905 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1906 let mut str = String::new();
1907 write!(
1908 f,
1909 "{}",
1910 match self {
1911 BoxShadow::None => "none",
1912 BoxShadow::List(items) => {
1913 for index in 0..items.len() {
1914 str.push_str(&items[index].to_string());
1915 if index < items.len() - 1 {
1916 str.push_str(", ")
1917 }
1918 }
1919 &str
1920 }
1921 }
1922 )
1923 }
1924}
1925impl fmt::Display for BoxShadowItem {
1926 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1927 let mut str = String::new();
1928 write!(
1929 f,
1930 "{}",
1931 match self {
1932 BoxShadowItem::List(items) => {
1933 for index in 0..items.len() {
1934 str.push_str(&items[index].to_string());
1935 if index < items.len() - 1 {
1936 str.push(' ')
1937 }
1938 }
1939 &str
1940 }
1941 }
1942 )
1943 }
1944}
1945impl fmt::Display for ShadowItemType {
1946 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1947 let x;
1948 write!(
1949 f,
1950 "{}",
1951 match self {
1952 ShadowItemType::Inset => "inset",
1953 ShadowItemType::OffsetX(len) => {
1954 x = len.to_string();
1955 &x
1956 }
1957 ShadowItemType::OffsetY(len) => {
1958 x = len.to_string();
1959 &x
1960 }
1961 ShadowItemType::BlurRadius(len) => {
1962 x = len.to_string();
1963 &x
1964 }
1965 ShadowItemType::SpreadRadius(len) => {
1966 x = len.to_string();
1967 &x
1968 }
1969 ShadowItemType::Color(len) => {
1970 x = len.to_string();
1971 &x
1972 }
1973 }
1974 )
1975 }
1976}
1977impl fmt::Display for BackdropFilter {
1978 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1979 let mut str = String::new();
1980 write!(
1981 f,
1982 "{}",
1983 match self {
1984 BackdropFilter::None => "none",
1985 BackdropFilter::List(items) => {
1986 for index in 0..items.len() {
1987 str.push_str(&items[index].to_string());
1988 if index < items.len() - 1 {
1989 str.push(' ')
1990 }
1991 }
1992 &str
1993 }
1994 }
1995 )
1996 }
1997}
1998impl fmt::Display for Filter {
1999 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2000 let mut str = String::new();
2001 write!(
2002 f,
2003 "{}",
2004 match self {
2005 Filter::None => "none",
2006 Filter::List(items) => {
2007 for index in 0..items.len() {
2008 str.push_str(&items[index].to_string());
2009 if index < items.len() - 1 {
2010 str.push(' ')
2011 }
2012 }
2013 &str
2014 }
2015 }
2016 )
2017 }
2018}
2019impl fmt::Display for FilterFunc {
2020 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2021 let x;
2022 write!(
2023 f,
2024 "{}",
2025 match self {
2026 FilterFunc::Url(len) => {
2027 x = format!("url({})", len.to_string());
2028 &x
2029 }
2030 FilterFunc::Blur(len) => {
2031 x = format!("blur({})", len);
2032 &x
2033 }
2034 FilterFunc::Brightness(len) => {
2035 x = format!("brightness({})", len);
2036 &x
2037 }
2038 FilterFunc::Contrast(len) => {
2039 x = format!("contranst({})", len);
2040 &x
2041 }
2042 FilterFunc::DropShadow(len) => {
2043 x = format!("drop-shadow({})", len);
2044 &x
2045 }
2046 FilterFunc::Grayscale(len) => {
2047 x = format!("grayscale({})", len);
2048 &x
2049 }
2050 FilterFunc::HueRotate(len) => {
2051 x = format!("hue-rotate({})", len);
2052 &x
2053 }
2054 FilterFunc::Invert(len) => {
2055 x = format!("invert({})", len);
2056 &x
2057 }
2058 FilterFunc::Opacity(len) => {
2059 x = format!("opacity({})", len);
2060 &x
2061 }
2062 FilterFunc::Saturate(len) => {
2063 x = format!("saturate({})", len);
2064 &x
2065 }
2066 FilterFunc::Sepia(len) => {
2067 x = format!("sepia({})", len);
2068 &x
2069 }
2070 }
2071 )
2072 }
2073}
2074impl fmt::Display for DropShadow {
2075 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2076 let mut str = String::new();
2077 write!(
2078 f,
2079 "{}",
2080 match self {
2081 DropShadow::List(items) => {
2082 for index in 0..items.len() {
2083 str.push_str(&items[index].to_string());
2084 if index < items.len() - 1 {
2085 str.push(' ')
2086 }
2087 }
2088 &str
2089 }
2090 }
2091 )
2092 }
2093}
2094impl fmt::Display for TransformOrigin {
2095 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2096 let mut tmp = String::new();
2097 write!(
2098 f,
2099 "{}",
2100 match self {
2101 TransformOrigin::LengthTuple(x, y, z) => {
2102 let horizontal_str = match x {
2103 n if *n == Length::Ratio(0.5) => "center".to_string(),
2104 n if *n == Length::Ratio(0.0) => "left".to_string(),
2105 n if *n == Length::Ratio(1.0) => "right".to_string(),
2106 x => x.to_string(),
2107 };
2108 let vertical_str = match y {
2109 n if *n == Length::Ratio(0.5) => "center".to_string(),
2110 n if *n == Length::Ratio(0.0) => "top".to_string(),
2111 n if *n == Length::Ratio(1.0) => "bottom".to_string(),
2112 y => y.to_string(),
2113 };
2114
2115 if horizontal_str == vertical_str {
2116 tmp.push_str("center");
2117 } else {
2118 tmp = format!("{} {}", horizontal_str, vertical_str);
2119 }
2120
2121 match z {
2122 n if *n == Length::Px(0.) => {}
2123 y => {
2124 tmp.push(' ');
2125 tmp.push_str(&y.to_string())
2126 }
2127 }
2128
2129 &tmp
2130 }
2131 TransformOrigin::Left => "left",
2132 TransformOrigin::Right => "right",
2133 TransformOrigin::Center => "center",
2134 TransformOrigin::Bottom => "bottom",
2135 TransformOrigin::Top => "top",
2136 TransformOrigin::Length(len) => {
2137 tmp = len.to_string();
2138 &tmp
2139 }
2140 }
2141 )
2142 }
2143}
2144
2145impl fmt::Display for MaskMode {
2146 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2147 let mut str = String::new();
2148 write!(
2149 f,
2150 "{}",
2151 match self {
2152 MaskMode::List(items) => {
2153 for index in 0..items.len() {
2154 str.push_str(&items[index].to_string());
2155 if index < items.len() - 1 {
2156 str.push_str(", ")
2157 }
2158 }
2159 &str
2160 }
2161 }
2162 )
2163 }
2164}
2165impl fmt::Display for MaskModeItem {
2166 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2167 write!(
2168 f,
2169 "{}",
2170 match self {
2171 MaskModeItem::MatchSource => "match-source",
2172 MaskModeItem::Alpha => "alpha",
2173 MaskModeItem::Luminance => "luminance",
2174 }
2175 )
2176 }
2177}
2178
2179impl fmt::Display for AspectRatio {
2180 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2181 match self {
2182 AspectRatio::Auto => write!(f, "auto"),
2183 AspectRatio::Ratio(x, y) => write!(f, "{} / {}", x, y),
2184 }
2185 }
2186}
2187
2188impl fmt::Display for Contain {
2189 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2190 match self {
2191 Contain::None => write!(f, "none"),
2192 Contain::Content => write!(f, "content"),
2193 Contain::Strict => write!(f, "strict"),
2194 Contain::Multiple(v) => {
2195 let mut ret = vec![];
2196 v.iter().for_each(|key| match key {
2197 ContainKeyword::Layout => ret.push("layout"),
2198 ContainKeyword::Paint => ret.push("paint"),
2199 ContainKeyword::Size => ret.push("size"),
2200 ContainKeyword::Style => ret.push("style"),
2201 });
2202 write!(f, "{}", ret.join(" "))
2203 }
2204 }
2205 }
2206}
2207
2208impl fmt::Display for Content {
2209 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2210 match self {
2211 Content::None => write!(f, "none"),
2212 Content::Normal => write!(f, "normal"),
2213 Content::Str(x) => write!(f, "{}", x.to_string()),
2214 Content::Url(x) => write!(f, "{}", x.to_string()),
2215 }
2216 }
2217}
2218
2219impl fmt::Display for CustomProperty {
2220 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2221 match self {
2222 CustomProperty::None => write!(f, "none"),
2223 CustomProperty::Expr(key, value) => {
2224 write!(f, "{}:{}", key.to_string(), value.to_string())
2225 }
2226 }
2227 }
2228}
2229
2230impl fmt::Display for AnimationName {
2231 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2232 let mut ret = vec![];
2233 match self {
2234 AnimationName::List(list) => list.iter().for_each(|x| match x {
2235 AnimationNameItem::None => ret.push("none".to_string()),
2236 AnimationNameItem::CustomIdent(ident) => ret.push(ident.to_string()),
2237 }),
2238 }
2239 write!(f, "{}", ret.join(","))
2240 }
2241}
2242
2243impl fmt::Display for AnimationDirection {
2244 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2245 let mut ret: Vec<&str> = vec![];
2246 match self {
2247 AnimationDirection::List(list) => list.iter().for_each(|x| match x {
2248 AnimationDirectionItem::Normal => ret.push("normal"),
2249 AnimationDirectionItem::Alternate => ret.push("alternate"),
2250 AnimationDirectionItem::AlternateReverse => ret.push("alternate-reverse"),
2251 AnimationDirectionItem::Reverse => ret.push("reverse"),
2252 }),
2253 }
2254 write!(f, "{}", ret.join(","))
2255 }
2256}
2257
2258impl fmt::Display for AnimationFillMode {
2259 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2260 let mut ret = vec![];
2261 match self {
2262 AnimationFillMode::List(list) => list.iter().for_each(|x| match x {
2263 AnimationFillModeItem::None => ret.push("none"),
2264 AnimationFillModeItem::Forwards => ret.push("forwards"),
2265 AnimationFillModeItem::Backwards => ret.push("backwords"),
2266 AnimationFillModeItem::Both => ret.push("both"),
2267 }),
2268 }
2269 write!(f, "{}", ret.join(","))
2270 }
2271}
2272
2273impl fmt::Display for AnimationIterationCount {
2274 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2275 let mut ret = vec![];
2276 match self {
2277 AnimationIterationCount::List(list) => list.iter().for_each(|x| match x {
2278 AnimationIterationCountItem::Infinite => ret.push("infinite".to_string()),
2279 AnimationIterationCountItem::Number(num) => ret.push(num.to_string()),
2280 }),
2281 }
2282 write!(f, "{}", ret.join(","))
2283 }
2284}
2285
2286impl fmt::Display for AnimationPlayState {
2287 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2288 let mut ret = vec![];
2289 match self {
2290 AnimationPlayState::List(list) => list.iter().for_each(|x| match x {
2291 AnimationPlayStateItem::Running => ret.push("running"),
2292 AnimationPlayStateItem::Paused => ret.push("paused"),
2293 }),
2294 }
2295 write!(f, "{}", ret.join(","))
2296 }
2297}
2298
2299impl fmt::Display for WillChange {
2300 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2301 let mut ret = vec![];
2302 match self {
2303 WillChange::Auto => ret.push("auto".to_string()),
2304 WillChange::List(list) => list.iter().for_each(|feature| match feature {
2305 AnimateableFeature::Contents => ret.push("contents".to_string()),
2306 AnimateableFeature::ScrollPosition => ret.push("scroll-position".to_string()),
2307 AnimateableFeature::CustomIdent(x) => ret.push(x.to_string()),
2308 }),
2309 };
2310 write!(f, "{}", ret.join(","))
2311 }
2312}
2313
2314impl fmt::Display for FontFeatureSettings {
2315 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2316 let mut ret = vec![];
2317 match self {
2318 FontFeatureSettings::Normal => ret.push("normal".to_string()),
2319 FontFeatureSettings::FeatureTags(tags) => tags.iter().for_each(|feature_tag_value| {
2320 ret.push(format!(
2321 "{} {}",
2322 feature_tag_value.opentype_tag.to_string(),
2323 feature_tag_value.value
2324 ));
2325 }),
2326 };
2327 write!(f, "{}", ret.join(","))
2328 }
2329}
2330
2331impl fmt::Display for Gap {
2332 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2333 match self {
2334 Gap::Normal => write!(f, "normal"),
2335 Gap::Length(length) => write!(f, "{}", length),
2336 }
2337 }
2338}