Struct serif::TimeFormat
source · pub struct TimeFormat { /* private fields */ }
Expand description
The style of timestamp to be formatted for tracing events.
Format strings are used by chrono::format::strftime
, and local timezone handling is
provided by the chrono
crate.
Implementations§
source§impl TimeFormat
impl TimeFormat
sourcepub const LOCAL_FORMAT: &'static str = "[%Y-%m-%dT%H:%M:%S%z]"
pub const LOCAL_FORMAT: &'static str = "[%Y-%m-%dT%H:%M:%S%z]"
RFC 3339 timestamp enclosed in square brackets, with offset.
sourcepub const UTC_FORMAT: &'static str = "[%Y-%m-%dT%H:%M:%SZ]"
pub const UTC_FORMAT: &'static str = "[%Y-%m-%dT%H:%M:%SZ]"
RFC 3339 timestamp enclosed in square brackets, with UTC (using ‘Z’ for the timezone instead of ‘+0000’)
sourcepub const fn local() -> Self
pub const fn local() -> Self
Render a timestamp in the local timezone using the default format.
sourcepub fn local_custom(format: impl Into<String>) -> Self
pub fn local_custom(format: impl Into<String>) -> Self
Render a timestamp in the local timezone using a custom format.
sourcepub fn utc_custom(format: impl Into<String>) -> Self
pub fn utc_custom(format: impl Into<String>) -> Self
Render a timestamp in UTC using a custom format.
sourcepub const fn local_const(format: &'static str) -> Self
pub const fn local_const(format: &'static str) -> Self
Render a timestamp in the local timezone using a static custom format.
sourcepub const fn utc_const(format: &'static str) -> Self
pub const fn utc_const(format: &'static str) -> Self
Render a timestamp in the utc timezone using a static custom format.
sourcepub fn format_timestamp(&self, datetime: &DateTime<Utc>) -> String
pub fn format_timestamp(&self, datetime: &DateTime<Utc>) -> String
Format a timestamp using the given DateTime.
This method always takes a DateTime<Utc>
, which will be converted to the local timezone
if necessary.
Trait Implementations§
source§impl Clone for TimeFormat
impl Clone for TimeFormat
source§fn clone(&self) -> TimeFormat
fn clone(&self) -> TimeFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more