actix_web::cookie::time::parsing

Struct Parsed

source
pub struct Parsed { /* private fields */ }
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.

Implementations§

source§

impl Parsed

source

pub const fn new() -> Parsed

Create a new instance of Parsed with no information known.

source

pub fn parse_item<'a>( &mut self, input: &'a [u8], item: &impl AnyFormatItem, ) -> Result<&'a [u8], ParseFromDescription>

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

If a BorrowedFormatItem::Optional or OwnedFormatItem::Optional is passed, parsing will not fail; the input will be returned as-is if the expected format is not present.

source

pub fn parse_items<'a>( &mut self, input: &'a [u8], items: &[impl AnyFormatItem], ) -> Result<&'a [u8], ParseFromDescription>

Parse a sequence of BorrowedFormatItems or OwnedFormatItems, mutating the struct. The remaining input is returned as the Ok value.

This method will fail if any of the contained BorrowedFormatItems or OwnedFormatItems fail to parse. self will not be mutated in this instance.

source

pub fn parse_literal<'a>( input: &'a [u8], literal: &[u8], ) -> Result<&'a [u8], ParseFromDescription>

Parse a literal byte sequence. The remaining input is returned as the Ok value.

source

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

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

source§

impl Parsed

Getter methods

source

pub const fn year(&self) -> Option<i32>

Obtain the year component.

source

pub const fn year_last_two(&self) -> Option<u8>

Obtain the year_last_two component.

source

pub const fn iso_year(&self) -> Option<i32>

Obtain the iso_year component.

source

pub const fn iso_year_last_two(&self) -> Option<u8>

Obtain the iso_year_last_two component.

source

pub const fn month(&self) -> Option<Month>

Obtain the month component.

source

pub const fn sunday_week_number(&self) -> Option<u8>

Obtain the sunday_week_number component.

source

pub const fn monday_week_number(&self) -> Option<u8>

Obtain the monday_week_number component.

source

pub const fn iso_week_number(&self) -> Option<NonZero<u8>>

Obtain the iso_week_number component.

source

pub const fn weekday(&self) -> Option<Weekday>

Obtain the weekday component.

source

pub const fn ordinal(&self) -> Option<NonZero<u16>>

Obtain the ordinal component.

source

pub const fn day(&self) -> Option<NonZero<u8>>

Obtain the day component.

source

pub const fn hour_24(&self) -> Option<u8>

Obtain the hour_24 component.

source

pub const fn hour_12(&self) -> Option<NonZero<u8>>

Obtain the hour_12 component.

source

pub const fn hour_12_is_pm(&self) -> Option<bool>

Obtain the hour_12_is_pm component.

source

pub const fn minute(&self) -> Option<u8>

Obtain the minute component.

source

pub const fn second(&self) -> Option<u8>

Obtain the second component.

source

pub const fn subsecond(&self) -> Option<u32>

Obtain the subsecond component.

source

pub const fn offset_hour(&self) -> Option<i8>

Obtain the offset_hour component.

source

pub const fn offset_minute_signed(&self) -> Option<i8>

Obtain the offset_minute component.

source

pub const fn offset_second_signed(&self) -> Option<i8>

Obtain the offset_second component.

source

pub const fn unix_timestamp_nanos(&self) -> Option<i128>

Obtain the unix_timestamp_nanos component.

source§

impl Parsed

Setter methods

All setters return Option<()>, which is Some if the value was set, and None if not. The setters may fail if the value is invalid, though behavior is not guaranteed.

source

pub fn set_year(&mut self, value: i32) -> Option<()>

Set the set_year component.

source

pub fn set_year_last_two(&mut self, value: u8) -> Option<()>

Set the set_year_last_two component.

source

pub fn set_iso_year(&mut self, value: i32) -> Option<()>

Set the set_iso_year component.

source

pub fn set_iso_year_last_two(&mut self, value: u8) -> Option<()>

Set the set_iso_year_last_two component.

source

pub fn set_month(&mut self, value: Month) -> Option<()>

Set the set_month component.

source

pub fn set_sunday_week_number(&mut self, value: u8) -> Option<()>

Set the set_sunday_week_number component.

source

pub fn set_monday_week_number(&mut self, value: u8) -> Option<()>

Set the set_monday_week_number component.

source

pub fn set_iso_week_number(&mut self, value: NonZero<u8>) -> Option<()>

Set the set_iso_week_number component.

source

pub fn set_weekday(&mut self, value: Weekday) -> Option<()>

Set the set_weekday component.

source

pub fn set_ordinal(&mut self, value: NonZero<u16>) -> Option<()>

Set the set_ordinal component.

source

pub fn set_day(&mut self, value: NonZero<u8>) -> Option<()>

Set the set_day component.

source

pub fn set_hour_24(&mut self, value: u8) -> Option<()>

Set the set_hour_24 component.

source

pub fn set_hour_12(&mut self, value: NonZero<u8>) -> Option<()>

Set the set_hour_12 component.

source

pub fn set_hour_12_is_pm(&mut self, value: bool) -> Option<()>

Set the set_hour_12_is_pm component.

source

pub fn set_minute(&mut self, value: u8) -> Option<()>

Set the set_minute component.

source

pub fn set_second(&mut self, value: u8) -> Option<()>

Set the set_second component.

source

pub fn set_subsecond(&mut self, value: u32) -> Option<()>

Set the set_subsecond component.

source

pub fn set_offset_hour(&mut self, value: i8) -> Option<()>

Set the set_offset_hour component.

source

pub fn set_offset_minute_signed(&mut self, value: i8) -> Option<()>

Set the set_offset_minute_signed component.

source

pub fn set_offset_second_signed(&mut self, value: i8) -> Option<()>

Set the set_offset_second_signed component.

source

pub fn set_unix_timestamp_nanos(&mut self, value: i128) -> Option<()>

Set the set_unix_timestamp_nanos component.

source§

impl Parsed

Builder methods

All builder methods return Option<Self>, which is Some if the value was set, and None if not. The builder methods may fail if the value is invalid, though behavior is not guaranteed.

source

pub const fn with_year(self, value: i32) -> Option<Parsed>

Set the year component and return self.

source

pub const fn with_year_last_two(self, value: u8) -> Option<Parsed>

Set the year_last_two component and return self.

source

pub const fn with_iso_year(self, value: i32) -> Option<Parsed>

Set the iso_year component and return self.

source

pub const fn with_iso_year_last_two(self, value: u8) -> Option<Parsed>

Set the iso_year_last_two component and return self.

source

pub const fn with_month(self, value: Month) -> Option<Parsed>

Set the month component and return self.

source

pub const fn with_sunday_week_number(self, value: u8) -> Option<Parsed>

Set the sunday_week_number component and return self.

source

pub const fn with_monday_week_number(self, value: u8) -> Option<Parsed>

Set the monday_week_number component and return self.

source

pub const fn with_iso_week_number(self, value: NonZero<u8>) -> Option<Parsed>

Set the iso_week_number component and return self.

source

pub const fn with_weekday(self, value: Weekday) -> Option<Parsed>

Set the weekday component and return self.

source

pub const fn with_ordinal(self, value: NonZero<u16>) -> Option<Parsed>

Set the ordinal component and return self.

source

pub const fn with_day(self, value: NonZero<u8>) -> Option<Parsed>

Set the day component and return self.

source

pub const fn with_hour_24(self, value: u8) -> Option<Parsed>

Set the hour_24 component and return self.

source

pub const fn with_hour_12(self, value: NonZero<u8>) -> Option<Parsed>

Set the hour_12 component and return self.

source

pub const fn with_hour_12_is_pm(self, value: bool) -> Option<Parsed>

Set the hour_12_is_pm component and return self.

source

pub const fn with_minute(self, value: u8) -> Option<Parsed>

Set the minute component and return self.

source

pub const fn with_second(self, value: u8) -> Option<Parsed>

Set the second component and return self.

source

pub const fn with_subsecond(self, value: u32) -> Option<Parsed>

Set the subsecond component and return self.

source

pub const fn with_offset_hour(self, value: i8) -> Option<Parsed>

Set the offset_hour component and return self.

source

pub const fn with_offset_minute_signed(self, value: i8) -> Option<Parsed>

Set the offset_minute component and return self.

source

pub const fn with_offset_second_signed(self, value: i8) -> Option<Parsed>

Set the offset_second component and return self.

source

pub const fn with_unix_timestamp_nanos(self, value: i128) -> Option<Parsed>

Set the unix_timestamp_nanos component and return self.

Trait Implementations§

source§

impl Clone for Parsed

source§

fn clone(&self) -> Parsed

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Parsed

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Parsed

source§

fn default() -> Parsed

Returns the “default value” for a type. Read more
source§

impl TryFrom<Parsed> for Date

source§

type Error = TryFromParsed

The type returned in the event of a conversion error.
source§

fn try_from(parsed: Parsed) -> Result<Date, <Date as TryFrom<Parsed>>::Error>

Performs the conversion.
source§

impl TryFrom<Parsed> for OffsetDateTime

source§

type Error = TryFromParsed

The type returned in the event of a conversion error.
source§

fn try_from( parsed: Parsed, ) -> Result<OffsetDateTime, <OffsetDateTime as TryFrom<Parsed>>::Error>

Performs the conversion.
source§

impl TryFrom<Parsed> for PrimitiveDateTime

source§

type Error = TryFromParsed

The type returned in the event of a conversion error.
source§

fn try_from( parsed: Parsed, ) -> Result<PrimitiveDateTime, <PrimitiveDateTime as TryFrom<Parsed>>::Error>

Performs the conversion.
source§

impl TryFrom<Parsed> for Time

source§

type Error = TryFromParsed

The type returned in the event of a conversion error.
source§

fn try_from(parsed: Parsed) -> Result<Time, <Time as TryFrom<Parsed>>::Error>

Performs the conversion.
source§

impl TryFrom<Parsed> for UtcOffset

source§

type Error = TryFromParsed

The type returned in the event of a conversion error.
source§

fn try_from( parsed: Parsed, ) -> Result<UtcOffset, <UtcOffset as TryFrom<Parsed>>::Error>

Performs the conversion.
source§

impl Copy for Parsed

Auto Trait Implementations§

§

impl Freeze for Parsed

§

impl RefUnwindSafe for Parsed

§

impl Send for Parsed

§

impl Sync for Parsed

§

impl Unpin for Parsed

§

impl UnwindSafe for Parsed

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more