Struct ParsedAnnotations

Source
pub(crate) struct ParsedAnnotations<'i> {
    input: Bytes<'i>,
    time_zone: Option<ParsedTimeZone<'i>>,
}
Expand description

The result of parsing RFC 9557 annotations.

Currently, this only provides access to a parsed time zone annotation, if present. While the parser does validate all other key/value annotations, Jiff doesn’t make use of them and thus does not expose them here. They are only validated at a syntax level.

Fields§

§input: Bytes<'i>

The original input that all of the annotations were parsed from.

N.B. This is currently unused, but potentially useful, so we leave it.

§time_zone: Option<ParsedTimeZone<'i>>

An optional time zone annotation that was extracted from the input.

Implementations§

Source§

impl<'i> ParsedAnnotations<'i>

Source

pub(crate) fn none() -> ParsedAnnotations<'static>

Return an empty parsed annotations.

Source

pub(crate) fn to_time_zone_annotation( &self, ) -> Result<Option<TimeZoneAnnotation<'i>>, Error>

Turns this parsed time zone into a structured time zone annotation, if an annotation was found. Otherwise, returns Ok(None).

This can return an error if the parsed offset could not be converted to a crate::tz::Offset.

Trait Implementations§

Source§

impl<'i> Debug for ParsedAnnotations<'i>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'i> Freeze for ParsedAnnotations<'i>

§

impl<'i> RefUnwindSafe for ParsedAnnotations<'i>

§

impl<'i> Send for ParsedAnnotations<'i>

§

impl<'i> Sync for ParsedAnnotations<'i>

§

impl<'i> Unpin for ParsedAnnotations<'i>

§

impl<'i> UnwindSafe for ParsedAnnotations<'i>

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.