14
14
//! These definitions are similar to their `ct` equivalents, but differ in that
15
15
//! these can be statically allocated and are slightly optimized for the runtime
16
16
17
- #![ allow( missing_doc) ]
18
- #![ doc( hidden) ]
19
-
20
17
use option:: Option ;
21
18
19
+ #[ doc( hidden) ]
22
20
pub enum Piece < ' a > {
23
21
String ( & ' a str ) ,
24
22
// FIXME(#8259): this shouldn't require the unit-value here
25
23
CurrentArgument ( ( ) ) ,
26
24
Argument ( Argument < ' a > ) ,
27
25
}
28
26
27
+ #[ doc( hidden) ]
29
28
pub struct Argument < ' a > {
30
29
pub position : Position ,
31
30
pub format : FormatSpec ,
32
31
pub method : Option < & ' a Method < ' a > >
33
32
}
34
33
34
+ #[ doc( hidden) ]
35
35
pub struct FormatSpec {
36
36
pub fill : char ,
37
37
pub align : Alignment ,
@@ -40,38 +40,60 @@ pub struct FormatSpec {
40
40
pub width : Count ,
41
41
}
42
42
43
+ /// Possible alignments that can be requested as part of a formatting directive.
43
44
#[ deriving( PartialEq ) ]
44
45
pub enum Alignment {
46
+ /// Indication that contents should be left-aligned.
45
47
AlignLeft ,
48
+ /// Indication that contents should be right-aligned.
46
49
AlignRight ,
50
+ /// No alignment was requested.
47
51
AlignUnknown ,
48
52
}
49
53
54
+ #[ doc( hidden) ]
50
55
pub enum Count {
51
56
CountIs ( uint ) , CountIsParam ( uint ) , CountIsNextParam , CountImplied ,
52
57
}
53
58
59
+ #[ doc( hidden) ]
54
60
pub enum Position {
55
61
ArgumentNext , ArgumentIs ( uint )
56
62
}
57
63
64
+ /// Flags which can be passed to formatting via a directive.
65
+ ///
66
+ /// These flags are discovered through the `flags` field of the `Formatter`
67
+ /// structure. The flag in that structure is a union of these flags into a
68
+ /// `uint` where each flag's discriminant is the corresponding bit.
58
69
pub enum Flag {
70
+ /// A flag which enables number formatting to always print the sign of a
71
+ /// number.
59
72
FlagSignPlus ,
73
+ /// Currently not a used flag
60
74
FlagSignMinus ,
75
+ /// Indicates that the "alternate formatting" for a type should be used.
76
+ ///
77
+ /// The meaning of this flag is type-specific.
61
78
FlagAlternate ,
79
+ /// Indicates that padding should be done with a `0` character as well as
80
+ /// being aware of the sign to be printed.
62
81
FlagSignAwareZeroPad ,
63
82
}
64
83
84
+ #[ doc( hidden) ]
65
85
pub enum Method < ' a > {
66
86
Plural ( Option < uint > , & ' a [ PluralArm < ' a > ] , & ' a [ Piece < ' a > ] ) ,
67
87
Select ( & ' a [ SelectArm < ' a > ] , & ' a [ Piece < ' a > ] ) ,
68
88
}
69
89
90
+ #[ doc( hidden) ]
70
91
pub enum PluralSelector {
71
92
Keyword ( PluralKeyword ) ,
72
93
Literal ( uint ) ,
73
94
}
74
95
96
+ #[ doc( hidden) ]
75
97
pub enum PluralKeyword {
76
98
Zero ,
77
99
One ,
@@ -80,11 +102,13 @@ pub enum PluralKeyword {
80
102
Many ,
81
103
}
82
104
105
+ #[ doc( hidden) ]
83
106
pub struct PluralArm < ' a > {
84
107
pub selector : PluralSelector ,
85
108
pub result : & ' a [ Piece < ' a > ] ,
86
109
}
87
110
111
+ #[ doc( hidden) ]
88
112
pub struct SelectArm < ' a > {
89
113
pub selector : & ' a str ,
90
114
pub result : & ' a [ Piece < ' a > ] ,
0 commit comments