Skip to main content

Chrono

Struct Chrono 

Source
pub struct Chrono {
    pub parsers: Vec<NamedParser>,
    pub refiners: Vec<NamedRefiner>,
    pub missing: Vec<&'static str>,
}
Expand description

upstream Chrono: an ordered list of parsers and refiners.

Fields§

§parsers: Vec<NamedParser>§refiners: Vec<NamedRefiner>§missing: Vec<&'static str>

Slots in the configuration whose step isn’t ported yet. They are skipped.

Implementations§

Source§

impl Chrono

Source

pub fn parse( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, ) -> Vec<ParsingResult>

parse(text, ref, option), with “now” taken from the system clock.

Source

pub fn parse_with_now( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, now: JsDate, ) -> Vec<ParsingResult>

parse with an explicit “now” (used when the reference is Now), for reproducible runs.

Source

pub fn trace_with_now( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, now: JsDate, ) -> (Vec<StepTrace>, Vec<StepTrace>)

parse_with_now, also returning each step’s output (the harness’s per-step comparison with chrono-node, harness/golden/frontier.js): every parser’s own results, then the results after each refiner. Same order and semantics as parse_with_now.

Source

pub fn refine_isolated( &self, context: &ParsingContext, step: &str, occurrence: usize, input: Vec<ParsingResult>, ) -> Option<Vec<ParsingResult>>

The occurrence-th refiner named step (0-based) run alone on input, or None if it isn’t ported. The harness feeds it chrono-node’s input for that slot, so each refiner is checked on every case even while an earlier step is unported (harness/golden/frontier.js).

Source

pub fn parse_date( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, ) -> Option<JsDate>

parseDate(text, ref, option).

Source

pub fn registered(&self) -> BTreeSet<&'static str>

Upstream class names of the parsers and refiners actually present.

Trait Implementations§

Source§

impl Clone for Chrono

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Default for Chrono

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Chrono

§

impl !UnwindSafe for Chrono

§

impl Forget for Chrono

§

impl Freeze for Chrono

§

impl Send for Chrono

§

impl Sync for Chrono

§

impl Unpin for Chrono

§

impl UnsafeUnpin for Chrono

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.