#[non_exhaustive]pub enum Format {
Constant(String),
Alternate {
standard: String,
dst: String,
},
Placeholder(String),
Offset,
}
Expand description
The format string to generate a time zone abbreviation from.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Constant(String)
A constant format, which remains the same throughout both standard and DST timespans.
Alternate
An alternate format, such as “PST/PDT”, which changes between standard and DST timespans.
Fields
Placeholder(String)
A format with a placeholder %s
, which uses the letters
field in
a RuleInfo
to generate the time zone abbreviation.
Offset
The special %z placeholder that gets formatted as a numeric offset.
Implementations§
Source§impl Format
impl Format
Sourcepub fn new(template: &str) -> Format
pub fn new(template: &str) -> Format
Convert the template into one of the Format
variants. This can’t
fail, as any syntax that doesn’t match one of the two formats will
just be a ‘constant’ format.
pub fn format( &self, utc_offset: i64, dst_offset: i64, letters: Option<&String>, ) -> String
pub fn format_constant(&self) -> String
Trait Implementations§
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnwindSafe for Format
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more