You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/fmt/mod.rs
+55-10Lines changed: 55 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ pub(crate) mod glob {
54
54
/// Seconds give precision of full seconds, milliseconds give thousands of a
55
55
/// second (3 decimal digits), microseconds are millionth of a second (6 decimal
56
56
/// digits) and nanoseconds are billionth of a second (9 decimal digits).
57
-
#[derive(Copy,Clone,Debug)]
57
+
#[derive(Copy,Clone,Debug,PartialEq,Eq)]
58
58
pubenumTimestampPrecision{
59
59
/// Full second precision (0 decimal digits)
60
60
Seconds,
@@ -73,6 +73,52 @@ impl Default for TimestampPrecision {
73
73
}
74
74
}
75
75
76
+
/// Standard used for formatting of timestamps.
77
+
///
78
+
/// RFC339 is the default and is a widely used internet standard, however it is not particularly human-readable.
79
+
/// Currently, we also support human-readable formats with either a 12 or 24 hour clock. Note that this currently only works with `TimestampPrecision::Seconds`.
80
+
#[derive(Copy,Clone,Debug,PartialEq,Eq)]
81
+
pubenumTimestampFormat{
82
+
/// Full RFC3339 conformance
83
+
RFC3339,
84
+
/// A human-readable standard of the form "YYYY:MM:DD HH:MM:SS AM/PM".
85
+
Human12Hour,
86
+
/// A human-readable standard of the form "YYYY:MM:DD HH:MM:SS"
87
+
Human24Hour,
88
+
}
89
+
90
+
/// The default timestamp style is the RFC3339 standard.
91
+
implDefaultforTimestampFormat{
92
+
fndefault() -> Self{
93
+
TimestampFormat::RFC3339
94
+
}
95
+
}
96
+
97
+
/// A styled timestamp, with precision and formatting.
98
+
///
99
+
/// Defaults to `TimestampFormat::RFC3339` and `TimestampPrecision::Seconds`.
100
+
#[derive(Copy,Clone,Debug,PartialEq,Eq,Default)]
101
+
pubstructTimestampStyle{
102
+
/// The format used for this style.
103
+
///
104
+
/// Determines how the timestamp is displayed. E.G. HH:MM:SS or YY:MM:DD
105
+
pubformat:TimestampFormat,
106
+
107
+
/// The precision used for this style.
108
+
///
109
+
/// Determines how accurate the displayed timestamp is.
110
+
pubprecision:TimestampPrecision,
111
+
}
112
+
113
+
implTimestampStyle{
114
+
/// Create a new `TimestampStyle` from a format and precision.
115
+
///
116
+
/// Rust's constructors can also be used instead of this method.
0 commit comments