Skip to main content

ClassTest

Enum ClassTest 

Source
pub enum ClassTest<'a> {
    Flat(&'a dyn Fn(&str, &str) -> String),
    Folded,
}
Expand description

How an engine asks whether a text holds a character of a class, for read_with_safe_cast and read_with_digit_check.

The readers hold a value to the picture’s shape. Flat, each rule is one test beside the next, each naming the value once and nesting nothing, so a value is no deeper than its marks’ own REPLACEs: an engine whose parser holds a hundred levels — SQLite 3.45’s — reads a wide table. Two of the rules need a class of characters (a digit; anything but a digit, a point or a minus), and that is what an engine is asked for here.

Variants§

§

Flat(&'a dyn Fn(&str, &str) -> String)

The engine’s own test: given a text and a bracket class — [0-9] or [^0-9.-], the spelling GLOB, SQL Server’s LIKE and every regular expression share — a condition true where the text holds at least one character of the class: x GLOB '*[0-9]*', x LIKE '%[0-9]%', REGEXP_LIKE(x, '[0-9]').

§

Folded

No such test: the value’s digits are folded with REPLACE into one shape and that is asked with LIKE alone, about twenty calls deep over the value. Ask for it only where the engine has neither a bracket class nor a regular expression.

Trait Implementations§

Source§

impl<'a> Clone for ClassTest<'a>

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<'a> Copy for ClassTest<'a>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ClassTest<'a>

§

impl<'a> !Send for ClassTest<'a>

§

impl<'a> !Sync for ClassTest<'a>

§

impl<'a> !UnwindSafe for ClassTest<'a>

§

impl<'a> Forget for ClassTest<'a>

§

impl<'a> Freeze for ClassTest<'a>

§

impl<'a> Move for ClassTest<'a>

§

impl<'a> Unpin for ClassTest<'a>

§

impl<'a> UnsafeUnpin for ClassTest<'a>

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.