pub(crate) trait ComponentProvider {
type State: Default;
const SUPPLIES_DATE: bool = false;
const SUPPLIES_TIME: bool = false;
const SUPPLIES_OFFSET: bool = false;
const SUPPLIES_TIMESTAMP: bool = false;
Show 23 methods
// Provided methods
fn day(&self, state: &mut Self::State) -> u8 { ... }
fn month(&self, state: &mut Self::State) -> Month { ... }
fn ordinal(&self, state: &mut Self::State) -> u16 { ... }
fn weekday(&self, state: &mut Self::State) -> Weekday { ... }
fn iso_week_number(&self, state: &mut Self::State) -> u8 { ... }
fn monday_based_week(&self, state: &mut Self::State) -> u8 { ... }
fn sunday_based_week(&self, state: &mut Self::State) -> u8 { ... }
fn calendar_year(&self, state: &mut Self::State) -> i32 { ... }
fn iso_year(&self, state: &mut Self::State) -> i32 { ... }
fn hour(&self, state: &mut Self::State) -> u8 { ... }
fn minute(&self, state: &mut Self::State) -> u8 { ... }
fn period(&self, state: &mut Self::State) -> Period { ... }
fn second(&self, state: &mut Self::State) -> u8 { ... }
fn nanosecond(&self, state: &mut Self::State) -> u32 { ... }
fn offset_is_negative(&self, state: &mut Self::State) -> bool { ... }
fn offset_is_utc(&self, state: &mut Self::State) -> bool { ... }
fn offset_hour(&self, state: &mut Self::State) -> i8 { ... }
fn offset_minute(&self, state: &mut Self::State) -> i8 { ... }
fn offset_second(&self, state: &mut Self::State) -> i8 { ... }
fn unix_timestamp_seconds(&self, state: &mut Self::State) -> i64 { ... }
fn unix_timestamp_milliseconds(&self, state: &mut Self::State) -> i64 { ... }
fn unix_timestamp_microseconds(&self, state: &mut Self::State) -> i128 { ... }
fn unix_timestamp_nanoseconds(&self, state: &mut Self::State) -> i128 { ... }
}formatting only.Expand description
A type with the ability to provide date, time, offset, and/or timestamp components on demand.
Note that while all methods have a default body, implementations are expected to override the body for all components that they provide. The default implementation exists solely for convenience, avoiding the need to specify unprovided components.
Provided Associated Constants§
Sourceconst SUPPLIES_DATE: bool = false
const SUPPLIES_DATE: bool = false
Whether the type can provide date components, indicating that date-related methods can be called.
Sourceconst SUPPLIES_TIME: bool = false
const SUPPLIES_TIME: bool = false
Whether the type can provide time components, indicating that time-related methods can be called.
Sourceconst SUPPLIES_OFFSET: bool = false
const SUPPLIES_OFFSET: bool = false
Whether the type can provide offset components, indicating that offset-related methods can be called.
Sourceconst SUPPLIES_TIMESTAMP: bool = false
const SUPPLIES_TIMESTAMP: bool = false
Whether the type can provide timestamp components, indicating that timestamp-related methods can be called.
Required Associated Types§
Provided Methods§
Sourcefn iso_week_number(&self, state: &mut Self::State) -> u8
fn iso_week_number(&self, state: &mut Self::State) -> u8
Obtain the ISO week number.
Sourcefn monday_based_week(&self, state: &mut Self::State) -> u8
fn monday_based_week(&self, state: &mut Self::State) -> u8
Obtain the Monday-based week number.
Sourcefn sunday_based_week(&self, state: &mut Self::State) -> u8
fn sunday_based_week(&self, state: &mut Self::State) -> u8
Obtain the Sunday-based week number.
Sourcefn calendar_year(&self, state: &mut Self::State) -> i32
fn calendar_year(&self, state: &mut Self::State) -> i32
Obtain the calendar year.
Sourcefn nanosecond(&self, state: &mut Self::State) -> u32
fn nanosecond(&self, state: &mut Self::State) -> u32
Obtain the nanosecond within the second.
Sourcefn offset_is_negative(&self, state: &mut Self::State) -> bool
fn offset_is_negative(&self, state: &mut Self::State) -> bool
Obtain whether the offset is negative.
Sourcefn offset_is_utc(&self, state: &mut Self::State) -> bool
fn offset_is_utc(&self, state: &mut Self::State) -> bool
Obtain whether the offset is UTC.
Sourcefn offset_hour(&self, state: &mut Self::State) -> i8
fn offset_hour(&self, state: &mut Self::State) -> i8
Obtain the hour component of the UTC offset.
Sourcefn offset_minute(&self, state: &mut Self::State) -> i8
fn offset_minute(&self, state: &mut Self::State) -> i8
Obtain the minute component of the UTC offset.
Sourcefn offset_second(&self, state: &mut Self::State) -> i8
fn offset_second(&self, state: &mut Self::State) -> i8
Obtain the second component of the UTC offset.
Sourcefn unix_timestamp_seconds(&self, state: &mut Self::State) -> i64
fn unix_timestamp_seconds(&self, state: &mut Self::State) -> i64
Obtain the Unix timestamp in seconds.
Sourcefn unix_timestamp_milliseconds(&self, state: &mut Self::State) -> i64
fn unix_timestamp_milliseconds(&self, state: &mut Self::State) -> i64
Obtain the Unix timestamp in milliseconds.
Sourcefn unix_timestamp_microseconds(&self, state: &mut Self::State) -> i128
fn unix_timestamp_microseconds(&self, state: &mut Self::State) -> i128
Obtain the Unix timestamp in microseconds.
Sourcefn unix_timestamp_nanoseconds(&self, state: &mut Self::State) -> i128
fn unix_timestamp_nanoseconds(&self, state: &mut Self::State) -> i128
Obtain the Unix timestamp in nanoseconds.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.