cl_format/tildes/
tilde_able_impl.rs1use super::*;
2
3impl<'a, 'arg> TildeAble for Args<'a, 'arg> {
4 fn len(&self) -> usize {
5 self.left_count()
6 }
7
8 fn into_tildekind_char(&self) -> Option<&dyn TildeKindChar> {
9 match self.pop() {
10 Some(a) => a.into_tildekind_char(),
11 None => None,
12 }
13 }
14
15 fn into_tildekind_float(&self) -> Option<&dyn TildeKindFloat> {
16 match self.pop() {
17 Some(a) => a.into_tildekind_float(),
18 None => None,
19 }
20 }
21
22 fn into_tildekind_digit(&self) -> Option<&dyn TildeKindDigit> {
23 match self.pop() {
24 Some(a) => a.into_tildekind_digit(),
25 None => None,
26 }
27 }
28
29 fn into_tildekind_va(&self) -> Option<&dyn TildeKindVa> {
30 match self.pop() {
31 Some(a) => a.into_tildekind_va(),
32 None => None,
33 }
34 }
35
36 fn into_tildekind_star(&self) -> Option<&dyn TildeKindStar> {
37 Some(self)
38 }
39
40 fn into_tildekind_loop(&self) -> Option<&dyn TildeKindLoop> {
41 Some(self)
42 }
43
44 fn into_tildekind_loopend(&self) -> Option<&dyn TildeKindLoopEnd> {
45 None
46 }
47
48 fn into_tildekind_cond(&self) -> Option<&dyn TildeKindCond> {
49 Some(self)
50 }
51
52 fn into_tildekind_text(&self) -> Option<&dyn TildeKindText> {
53 None
54 }
55
56 fn into_tildekind_vectilde(&self) -> Option<&dyn TildeKindVecTilde> {
57 Some(self)
58 }
59
60 fn into_tildekind_standard(&self) -> Option<&dyn TildeKindStandard> {
61 match self.pop() {
62 Some(a) => a.into_tildekind_standard(),
63 None => None,
64 }
65 }
66
67 fn into_tildekind_tildes(&self) -> Option<&dyn TildeKindTildes> {
68 None
69 }
70
71 fn into_tildekind_radix(&self) -> Option<&dyn TildeKindRadix> {
72 match self.pop() {
73 Some(a) => a.into_tildekind_radix(),
74 None => None,
75 }
76 }
77}
78
79impl TildeAble for Option<&dyn TildeAble> {
81 fn len(&self) -> usize {
82 match self {
83 Some(_) => 1,
84 None => 0,
85 }
86 }
87
88 fn into_tildekind_cond(&self) -> Option<&dyn TildeKindCond> {
89 Some(self)
90 }
91}
92
93impl TildeAble for Vec<&dyn TildeAble> {
94 fn len(&self) -> usize {
95 self.len()
96 }
97
98 fn into_tildekind_va(&self) -> Option<&dyn TildeKindVa> {
99 Some(self)
100 }
101
102 fn into_tildekind_loop(&self) -> Option<&dyn TildeKindLoop> {
103 Some(self)
104 }
105}