pub trait Time {
Show 13 methods
// Required methods
fn year(&self) -> i32;
fn month(&self) -> u8;
fn day(&self) -> u8;
fn hour(&self) -> u8;
fn minute(&self) -> u8;
fn second(&self) -> u8;
fn nanoseconds(&self) -> u32;
fn day_of_week(&self) -> u8;
fn day_of_year(&self) -> u16;
fn to_int(&self) -> i64;
fn is_utc(&self) -> bool;
fn utc_offset(&self) -> i32;
fn time_zone(&self) -> &str;
}Expand description
Common methods needed for formatting time.
This should be implemented for structs representing a time.
All the strftime functions take as input an implementation of this trait.
Required Methods§
Sourcefn nanoseconds(&self) -> u32
fn nanoseconds(&self) -> u32
Returns the number of nanoseconds in 0..=999_999_999 for time.
Sourcefn day_of_week(&self) -> u8
fn day_of_week(&self) -> u8
Returns an integer representing the day of the week in 0..=6, with
Sunday == 0.
Sourcefn day_of_year(&self) -> u16
fn day_of_year(&self) -> u16
Returns an integer representing the day of the year in 1..=366.
Sourcefn utc_offset(&self) -> i32
fn utc_offset(&self) -> i32
Returns the offset in seconds between the timezone of time and UTC.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".