[go: up one dir, main page]

Struct time::parsing::Parsed[][src]

#[non_exhaustive]
pub struct Parsed {
Show fields pub year: Option<i32>, pub year_last_two: Option<u8>, pub iso_year: Option<i32>, pub iso_year_last_two: Option<u8>, pub month: Option<Month>, pub sunday_week_number: Option<u8>, pub monday_week_number: Option<u8>, pub iso_week_number: Option<NonZeroU8>, pub weekday: Option<Weekday>, pub ordinal: Option<NonZeroU16>, pub day: Option<NonZeroU8>, pub hour_24: Option<u8>, pub hour_12: Option<NonZeroU8>, pub hour_12_is_pm: Option<bool>, pub minute: Option<u8>, pub second: Option<u8>, pub subsecond: Option<u32>, pub offset_hour: Option<i8>, pub offset_minute: Option<u8>, pub offset_second: Option<u8>,
}
This is supported on crate feature parsing only.
Expand description

All information parsed.

This information is directly used to construct the final values.

Most users will not need think about this struct in any way. It is public to allow for manual control over values, in the instance that the default parser is insufficient.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
year: Option<i32>

Calendar year.

year_last_two: Option<u8>

The last two digits of the calendar year.

iso_year: Option<i32>

Year of the ISO week date.

iso_year_last_two: Option<u8>

The last two digits of the ISO week year.

month: Option<Month>

Month of the year.

sunday_week_number: Option<u8>

Week of the year, where week one begins on the first Sunday of the calendar year.

monday_week_number: Option<u8>

Week of the year, where week one begins on the first Monday of the calendar year.

iso_week_number: Option<NonZeroU8>

Week of the year, where week one is the Monday-to-Sunday period containing January 4.

weekday: Option<Weekday>

Day of the week.

ordinal: Option<NonZeroU16>

Day of the year.

day: Option<NonZeroU8>

Day of the month.

hour_24: Option<u8>

Hour within the day.

hour_12: Option<NonZeroU8>

Hour within the 12-hour period (midnight to noon or vice versa). This is typically used in conjunction with AM/PM, which is indicated by the hour_12_is_pm field.

hour_12_is_pm: Option<bool>

Whether the hour_12 field indicates a time that “PM”.

minute: Option<u8>

Minute within the hour.

second: Option<u8>

Second within the minute.

subsecond: Option<u32>

Nanosecond within the second.

offset_hour: Option<i8>

Whole hours of the UTC offset.

offset_minute: Option<u8>

Minutes within the hour of the UTC offset.

offset_second: Option<u8>

Seconds within the minute of the UTC offset.

Implementations

impl Parsed[src]

pub const fn new() -> Self[src]

Create a new instance of Parsed with no information known.

pub fn parse_component<'a>(
    &mut self,
    input: &'a [u8],
    component: Component
) -> Result<&'a [u8], ParseFromDescription>
[src]

Parse a single component, mutating the struct. The remaining input is returned as the Ok value.

Trait Implementations

impl Clone for Parsed[src]

fn clone(&self) -> Parsed[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Parsed[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl TryFrom<Parsed> for Date[src]

type Error = TryFromParsed

The type returned in the event of a conversion error.

fn try_from(parsed: Parsed) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl TryFrom<Parsed> for Time[src]

type Error = TryFromParsed

The type returned in the event of a conversion error.

fn try_from(parsed: Parsed) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl TryFrom<Parsed> for UtcOffset[src]

type Error = TryFromParsed

The type returned in the event of a conversion error.

fn try_from(parsed: Parsed) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl TryFrom<Parsed> for PrimitiveDateTime[src]

type Error = TryFromParsed

The type returned in the event of a conversion error.

fn try_from(parsed: Parsed) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl TryFrom<Parsed> for OffsetDateTime[src]

type Error = TryFromParsed

The type returned in the event of a conversion error.

fn try_from(parsed: Parsed) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl Copy for Parsed[src]

Auto Trait Implementations

impl RefUnwindSafe for Parsed

impl Send for Parsed

impl Sync for Parsed

impl Unpin for Parsed

impl UnwindSafe for Parsed

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.