Struct SpanParser

Source
pub(super) struct SpanParser {
    _priv: (),
}
Expand description

A parser for Temporal spans.

Note that in Temporal, a “span” is called a “duration.”

Fields§

§_priv: ()

There are currently no configuration options for this parser.

Implementations§

Source§

impl SpanParser

Source

pub(super) const fn new() -> SpanParser

Create a new Temporal span parser with the default configuration.

Source

pub(super) fn parse_temporal_duration<'i>( &self, input: &'i [u8], ) -> Result<Parsed<'i, Span>, Error>

Source

pub(super) fn parse_signed_duration<'i>( &self, input: &'i [u8], ) -> Result<Parsed<'i, SignedDuration>, Error>

Source

fn parse_span<'i>(&self, input: &'i [u8]) -> Result<Parsed<'i, Span>, Error>

Source

fn parse_duration<'i>( &self, input: &'i [u8], ) -> Result<Parsed<'i, SignedDuration>, Error>

Source

fn parse_date_units<'i>( &self, input: &'i [u8], span: Span, ) -> Result<Parsed<'i, (Span, bool)>, Error>

Parses consecutive date units from an ISO 8601 duration string into the span given.

If 1 or more units were found, then true is also returned. Otherwise, false indicates that no units were parsed. (Which the caller may want to treat as an error.)

Source

fn parse_time_units<'i>( &self, input: &'i [u8], span: Span, ) -> Result<Parsed<'i, (Span, bool)>, Error>

Parses consecutive time units from an ISO 8601 duration string into the span given.

If 1 or more units were found, then true is also returned. Otherwise, false indicates that no units were parsed. (Which the caller may want to treat as an error.)

Source

fn parse_time_units_duration<'i>( &self, input: &'i [u8], negative: bool, ) -> Result<Parsed<'i, SignedDuration>, Error>

Parses consecutive time units from an ISO 8601 duration string into a Jiff signed duration.

If no time units are found, then this returns an error.

Source

fn parse_unit_value<'i>( &self, input: &'i [u8], ) -> Result<Parsed<'i, Option<ri64<{ _ }, { _ }>>>, Error>

Source

fn parse_unit_date_designator<'i>( &self, input: &'i [u8], ) -> Result<Parsed<'i, Unit>, Error>

Source

fn parse_unit_time_designator<'i>( &self, input: &'i [u8], ) -> Result<Parsed<'i, Unit>, Error>

Source

fn parse_duration_designator<'i>( &self, input: &'i [u8], ) -> Result<Parsed<'i, ()>, Error>

Source

fn parse_time_designator<'i>(&self, input: &'i [u8]) -> Parsed<'i, bool>

Source

fn parse_sign<'i>(&self, input: &'i [u8]) -> Parsed<'i, ri8<-1, 1>>

Trait Implementations§

Source§

impl Debug for SpanParser

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.