Struct Parse

Source
pub struct Parse<'z, Tz2> { /* private fields */ }
Expand description

Parse struct has methods implemented parsers for accepted formats.

Implementations§

Source§

impl<'z, Tz2> Parse<'z, Tz2>
where Tz2: TimeZone,

Source

pub const fn new(tz: &'z Tz2, default_time: NaiveTime) -> Self

Create a new instance of Parse with a custom parsing timezone that handles the datetime string without time offset.

Source

pub const fn prefer_dmy(&mut self, yes: bool) -> &Self

Source

pub const fn new_with_preference( tz: &'z Tz2, default_time: NaiveTime, prefer_dmy: bool, ) -> Self

Create a new instance of Parse with a custom parsing timezone that handles the datetime string without time offset, and the date parsing preference.

Source

pub fn parse(&self, input: &str) -> Result<DateTime<Utc>>

This method tries to parse the input datetime string with a list of accepted formats. See more examples from Parse, crate::parse() and crate::parse_with_timezone().

Auto Trait Implementations§

§

impl<'z, Tz2> Freeze for Parse<'z, Tz2>

§

impl<'z, Tz2> RefUnwindSafe for Parse<'z, Tz2>
where Tz2: RefUnwindSafe,

§

impl<'z, Tz2> Send for Parse<'z, Tz2>
where Tz2: Sync,

§

impl<'z, Tz2> Sync for Parse<'z, Tz2>
where Tz2: Sync,

§

impl<'z, Tz2> Unpin for Parse<'z, Tz2>

§

impl<'z, Tz2> UnwindSafe for Parse<'z, Tz2>
where Tz2: RefUnwindSafe,

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.