Skip to main content

Datetime

Struct Datetime 

Source
pub struct Datetime {}

Trait Implementations§

Source§

impl Default for Datetime

Source§

fn default() -> Self

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

impl Finder for Datetime

Source§

fn line_agnostic(&self) -> bool

Whether try_at/try_trigger_at give the same answer on a whole buffer as on the line alone: \n and \r never belong to a match, and every walk treats them exactly like the end of the input (as a boundary), so a match never depends on what surrounds its line. A finder that matches “up to the end of the line” (codetag), accepts line terminators as whitespace (JSON, phone) or otherwise looks at the line as a whole must keep the default. Line-agnostic finders are run over whole buffers with absolute positions, which lets the scanner skip resolving the line of every candidate; property tests compare both modes. Defaults to false.
Source§

fn id(&self) -> &'static str

Returns a unique identifier for this finder.
Source§

fn dispatchable(&self) -> bool

Whether this finder supports dispatch-mode scanning via try_at.
Source§

fn could_start_at(&self, byte: u8) -> bool

Whether the given byte could be the first byte of a match. Only meaningful when dispatchable returns true.
Source§

fn could_start_after(&self, prev: u8, _cur: u8) -> bool

Whether a match could be attempted at byte cur when the byte immediately before it is prev: a dispatch-mode start, or a trigger-mode trigger byte. Read more
Source§

fn could_continue_with(&self, _cur: u8, next: u8) -> bool

Whether an attempt at byte cur could succeed when the byte immediately after it is next. Same contract as could_start_after.
Source§

fn anchor(&self) -> Option<Anchor>

Bytes every match of this dispatch finder contains (bytes), and the bytes that can separate a match start from the first of them (walk). When every finder of a scanner declares an anchor (or is a trigger finder) and the anchor bytes number three or fewer, the scanner searches for those bytes with memchr, walks back over walk and tries the dispatch positions in order, so lines without an anchor byte cost nothing. Read more
Source§

fn run_rules(&self) -> Vec<RunRule>

Rules on the digit or hex run starting at a candidate position, evaluated with RunRule::allow before try_at is called. Same contract as could_start_after: when the rules reject a position, try_at must return None there. The scanner measures the runs once per position for all finders.
Source§

fn try_at(&self, input: &[u8], pos: usize) -> Option<Range<usize>>

Try to find a match starting exactly at pos in the full input. Only called when dispatchable returns true.
Source§

fn find(&self, s: &str) -> Option<Range<usize>>

Finds the first match in the given string. Read more
Source§

fn try_at_memo( &self, input: &[u8], pos: usize, memo: &mut Memo, ) -> Option<Range<usize>>

try_at with a per-line Memo; the scanner calls this variant. Finders whose attempts can rescan the same bytes override it to remember what already failed. Must return exactly what try_at returns.
Source§

fn try_trigger_at_memo( &self, input: &[u8], pos: usize, memo: &mut Memo, ) -> Option<Range<usize>>

try_trigger_at with a per-line Memo, same contract as try_at_memo.
Source§

fn prefixes(&self) -> Vec<Vec<u8>>

Byte strings, ASCII case ignored, one of which starts the input at every position where try_at can match (todo for --todo codetags). A finder that would otherwise need the block classifier is then found by searching for them. Empty when unknown. Read more
Source§

fn triggerable(&self) -> bool

Whether this finder supports trigger-mode scanning. Read more
Source§

fn could_trigger_at(&self, _byte: u8) -> bool

Whether the given byte could trigger a match for this finder. Only meaningful when triggerable returns true.
Source§

fn has_trigger_context(&self) -> bool

Whether the trigger context gate constrains anything: the scanner then tabulates trigger_context over the 65536 pairs of previous bytes and trigger_context_exempt over the next bytes, once, and consults them before calling the finder. Defaults to false.
Source§

fn trigger_context(&self, _prev2: u8, _prev1: u8) -> bool

Whether a match may be triggered at a byte preceded by prev2 and prev1, unless the byte after the trigger is exempt (trigger_context_exempt): a necessary condition for try_trigger_at to match at that position. The scanner passes a space for a missing previous byte (the trigger sits in the first two bytes of the input). Defaults to true.
Source§

fn trigger_context_exempt(&self, _next: Option<u8>) -> bool

Whether a trigger followed by next (None at the end of the input) escapes the previous-bytes condition: the URI finder needs a registered scheme before a colon unless // follows. Defaults to false.
Source§

fn try_trigger_at(&self, _input: &[u8], _pos: usize) -> Option<Range<usize>>

Try to find a match triggered by pos in the full input. Only called when triggerable returns true.

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 = !

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.