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
impl Parsed
impl Parsed
pub fn parse_item(
&mut self,
input: &'a [u8],
item: &FormatItem<'_>
) -> Result<&'a [u8], ParseFromDescription>
pub fn parse_item(
&mut self,
input: &'a [u8],
item: &FormatItem<'_>
) -> Result<&'a [u8], ParseFromDescription>
Parse a single FormatItem, mutating the struct. The remaining input is returned as the
Ok value.
If a FormatItem::Optional is passed, parsing will not fail; the input will be returned
as-is if the expected format is not present.
pub fn parse_items(
&mut self,
input: &'a [u8],
items: &[FormatItem<'_>]
) -> Result<&'a [u8], ParseFromDescription>
pub fn parse_items(
&mut self,
input: &'a [u8],
items: &[FormatItem<'_>]
) -> Result<&'a [u8], ParseFromDescription>
Parse a sequence of FormatItems, mutating the struct. The remaining input is returned as
the Ok value.
This method will fail if any of the contained FormatItems fail to parse. self will not
be mutated in this instance.
pub fn parse_literal(
input: &'a [u8],
literal: &[u8]
) -> Result<&'a [u8], ParseFromDescription>
pub fn parse_literal(
input: &'a [u8],
literal: &[u8]
) -> Result<&'a [u8], ParseFromDescription>
Parse a literal byte sequence. The remaining input is returned as the Ok value.
pub fn parse_component(
&mut self,
input: &'a [u8],
component: Component
) -> Result<&'a [u8], ParseFromDescription>
pub fn parse_component(
&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.
impl Parsed
impl Parsed
Getter methods
pub const fn year_last_two(&self) -> Option<u8>
pub const fn year_last_two(&self) -> Option<u8>
Obtain the named component.
pub const fn iso_year_last_two(&self) -> Option<u8>
pub const fn iso_year_last_two(&self) -> Option<u8>
Obtain the named component.
pub const fn sunday_week_number(&self) -> Option<u8>
pub const fn sunday_week_number(&self) -> Option<u8>
Obtain the named component.
pub const fn monday_week_number(&self) -> Option<u8>
pub const fn monday_week_number(&self) -> Option<u8>
Obtain the named component.
pub const fn iso_week_number(&self) -> Option<NonZeroU8>
pub const fn iso_week_number(&self) -> Option<NonZeroU8>
Obtain the named component.
pub const fn ordinal(&self) -> Option<NonZeroU16>
pub const fn ordinal(&self) -> Option<NonZeroU16>
Obtain the named component.
pub const fn hour_12_is_pm(&self) -> Option<bool>
pub const fn hour_12_is_pm(&self) -> Option<bool>
Obtain the named component.
pub const fn offset_hour(&self) -> Option<i8>
pub const fn offset_hour(&self) -> Option<i8>
Obtain the named component.
pub const fn offset_minute(&self) -> Option<u8>
👎 Deprecated since 0.3.8: use parsed.offset_minute_signed() instead
pub const fn offset_minute(&self) -> Option<u8>
use parsed.offset_minute_signed() instead
Obtain the absolute value of the offset minute.
pub const fn offset_minute_signed(&self) -> Option<i8>
pub const fn offset_minute_signed(&self) -> Option<i8>
Obtain the offset minute as an i8.
pub const fn offset_second(&self) -> Option<u8>
👎 Deprecated since 0.3.8: use parsed.offset_second_signed() instead
pub const fn offset_second(&self) -> Option<u8>
use parsed.offset_second_signed() instead
Obtain the absolute value of the offset second.
pub const fn offset_second_signed(&self) -> Option<i8>
pub const fn offset_second_signed(&self) -> Option<i8>
Obtain the offset second as an i8.
impl Parsed
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.
pub fn set_year_last_two(&mut self, value: u8) -> Option<()>
pub fn set_year_last_two(&mut self, value: u8) -> Option<()>
Set the named component.
pub fn set_iso_year(&mut self, value: i32) -> Option<()>
pub fn set_iso_year(&mut self, value: i32) -> Option<()>
Set the named component.
pub fn set_iso_year_last_two(&mut self, value: u8) -> Option<()>
pub fn set_iso_year_last_two(&mut self, value: u8) -> Option<()>
Set the named component.
pub fn set_sunday_week_number(&mut self, value: u8) -> Option<()>
pub fn set_sunday_week_number(&mut self, value: u8) -> Option<()>
Set the named component.
pub fn set_monday_week_number(&mut self, value: u8) -> Option<()>
pub fn set_monday_week_number(&mut self, value: u8) -> Option<()>
Set the named component.
pub fn set_iso_week_number(&mut self, value: NonZeroU8) -> Option<()>
pub fn set_iso_week_number(&mut self, value: NonZeroU8) -> Option<()>
Set the named component.
pub fn set_weekday(&mut self, value: Weekday) -> Option<()>
pub fn set_weekday(&mut self, value: Weekday) -> Option<()>
Set the named component.
pub fn set_ordinal(&mut self, value: NonZeroU16) -> Option<()>
pub fn set_ordinal(&mut self, value: NonZeroU16) -> Option<()>
Set the named component.
pub fn set_hour_24(&mut self, value: u8) -> Option<()>
pub fn set_hour_24(&mut self, value: u8) -> Option<()>
Set the named component.
pub fn set_hour_12(&mut self, value: NonZeroU8) -> Option<()>
pub fn set_hour_12(&mut self, value: NonZeroU8) -> Option<()>
Set the named component.
pub fn set_hour_12_is_pm(&mut self, value: bool) -> Option<()>
pub fn set_hour_12_is_pm(&mut self, value: bool) -> Option<()>
Set the named component.
pub fn set_minute(&mut self, value: u8) -> Option<()>
pub fn set_minute(&mut self, value: u8) -> Option<()>
Set the named component.
pub fn set_second(&mut self, value: u8) -> Option<()>
pub fn set_second(&mut self, value: u8) -> Option<()>
Set the named component.
pub fn set_subsecond(&mut self, value: u32) -> Option<()>
pub fn set_subsecond(&mut self, value: u32) -> Option<()>
Set the named component.
pub fn set_offset_hour(&mut self, value: i8) -> Option<()>
pub fn set_offset_hour(&mut self, value: i8) -> Option<()>
Set the named component.
pub fn set_offset_minute(&mut self, value: u8) -> Option<()>
👎 Deprecated since 0.3.8: use parsed.set_offset_minute_signed() instead
pub fn set_offset_minute(&mut self, value: u8) -> Option<()>
use parsed.set_offset_minute_signed() instead
Set the named component.
pub fn set_offset_minute_signed(&mut self, value: i8) -> Option<()>
pub fn set_offset_minute_signed(&mut self, value: i8) -> Option<()>
Set the offset_minute component.
pub fn set_offset_second(&mut self, value: u8) -> Option<()>
👎 Deprecated since 0.3.8: use parsed.set_offset_second_signed() instead
pub fn set_offset_second(&mut self, value: u8) -> Option<()>
use parsed.set_offset_second_signed() instead
Set the named component.
pub fn set_offset_second_signed(&mut self, value: i8) -> Option<()>
pub fn set_offset_second_signed(&mut self, value: i8) -> Option<()>
Set the offset_second component.
impl Parsed
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.
pub const fn with_year_last_two(self, value: u8) -> Option<Parsed>
pub const fn with_year_last_two(self, value: u8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_iso_year(self, value: i32) -> Option<Parsed>
pub const fn with_iso_year(self, value: i32) -> Option<Parsed>
Set the named component and return self.
pub const fn with_iso_year_last_two(self, value: u8) -> Option<Parsed>
pub const fn with_iso_year_last_two(self, value: u8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_month(self, value: Month) -> Option<Parsed>
pub const fn with_month(self, value: Month) -> Option<Parsed>
Set the named component and return self.
pub const fn with_sunday_week_number(self, value: u8) -> Option<Parsed>
pub const fn with_sunday_week_number(self, value: u8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_monday_week_number(self, value: u8) -> Option<Parsed>
pub const fn with_monday_week_number(self, value: u8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_iso_week_number(self, value: NonZeroU8) -> Option<Parsed>
pub const fn with_iso_week_number(self, value: NonZeroU8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_weekday(self, value: Weekday) -> Option<Parsed>
pub const fn with_weekday(self, value: Weekday) -> Option<Parsed>
Set the named component and return self.
pub const fn with_ordinal(self, value: NonZeroU16) -> Option<Parsed>
pub const fn with_ordinal(self, value: NonZeroU16) -> Option<Parsed>
Set the named component and return self.
pub const fn with_day(self, value: NonZeroU8) -> Option<Parsed>
pub const fn with_day(self, value: NonZeroU8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_hour_24(self, value: u8) -> Option<Parsed>
pub const fn with_hour_24(self, value: u8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_hour_12(self, value: NonZeroU8) -> Option<Parsed>
pub const fn with_hour_12(self, value: NonZeroU8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_hour_12_is_pm(self, value: bool) -> Option<Parsed>
pub const fn with_hour_12_is_pm(self, value: bool) -> Option<Parsed>
Set the named component and return self.
pub const fn with_minute(self, value: u8) -> Option<Parsed>
pub const fn with_minute(self, value: u8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_second(self, value: u8) -> Option<Parsed>
pub const fn with_second(self, value: u8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_subsecond(self, value: u32) -> Option<Parsed>
pub const fn with_subsecond(self, value: u32) -> Option<Parsed>
Set the named component and return self.
pub const fn with_offset_hour(self, value: i8) -> Option<Parsed>
pub const fn with_offset_hour(self, value: i8) -> Option<Parsed>
Set the named component and return self.
pub const fn with_offset_minute(self, value: u8) -> Option<Parsed>
👎 Deprecated since 0.3.8: use parsed.with_offset_minute_signed() instead
pub const fn with_offset_minute(self, value: u8) -> Option<Parsed>
use parsed.with_offset_minute_signed() instead
Set the named component and return self.
pub const fn with_offset_minute_signed(self, value: i8) -> Option<Parsed>
pub const fn with_offset_minute_signed(self, value: i8) -> Option<Parsed>
Set the offset_minute component and return self.
pub const fn with_offset_second(self, value: u8) -> Option<Parsed>
👎 Deprecated since 0.3.8: use parsed.with_offset_second_signed() instead
pub const fn with_offset_second(self, value: u8) -> Option<Parsed>
use parsed.with_offset_second_signed() instead
Set the named component and return self.
pub const fn with_offset_second_signed(self, value: i8) -> Option<Parsed>
pub const fn with_offset_second_signed(self, value: i8) -> Option<Parsed>
Set the offset_second component and return self.
Trait Implementations
impl TryFrom<Parsed> for OffsetDateTime
impl TryFrom<Parsed> for OffsetDateTime
type Error = TryFromParsed
type Error = TryFromParsed
The type returned in the event of a conversion error.
fn try_from(
parsed: Parsed
) -> Result<OffsetDateTime, <OffsetDateTime as TryFrom<Parsed>>::Error>
fn try_from(
parsed: Parsed
) -> Result<OffsetDateTime, <OffsetDateTime as TryFrom<Parsed>>::Error>
Performs the conversion.
impl TryFrom<Parsed> for PrimitiveDateTime
impl TryFrom<Parsed> for PrimitiveDateTime
type Error = TryFromParsed
type Error = TryFromParsed
The type returned in the event of a conversion error.
fn try_from(
parsed: Parsed
) -> Result<PrimitiveDateTime, <PrimitiveDateTime as TryFrom<Parsed>>::Error>
fn try_from(
parsed: Parsed
) -> Result<PrimitiveDateTime, <PrimitiveDateTime as TryFrom<Parsed>>::Error>
Performs the conversion.
impl Copy for Parsed
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self to use its Binary implementation when Debug-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self to use its Display implementation when
Debug-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self to use its LowerExp implementation when
Debug-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self to use its LowerHex implementation when
Debug-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Causes self to use its Octal implementation when Debug-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self to use its Pointer implementation when
Debug-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self to use its UpperExp implementation when
Debug-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self to use its UpperHex implementation when
Debug-formatted. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T, U, I> LiftInto<U, I> for T where
U: LiftFrom<T, I>,
impl<T, U, I> LiftInto<U, I> for T where
U: LiftFrom<T, I>,
fn lift_into(self) -> U
fn lift_into(self) -> U
Performs the indexed conversion.
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
Borrows self and passes that borrow into the pipe function. Read more
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
Mutably borrows self and passes that borrow into the pipe function. Read more
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
Borrows self, then passes self.borrow() into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
Mutably borrows self, then passes self.borrow_mut() into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows self, then passes self.as_ref() into the pipe function.
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self, then passes self.as_mut() into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self, then passes self.deref() into the pipe function.
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B> of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B> of a value. Read more
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Immutable access to the AsRef<R> view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R> view of a value. Read more
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the Deref::Target of a value. Read more
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the Deref::Target of a value. Read more
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls .tap() only in debug builds, and is erased in release builds.
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut() only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow() only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut() only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref() only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut() only in debug builds, and is erased in release
builds. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more