Skip to main content

KeywordOperators

Enum KeywordOperators 

Source
pub enum KeywordOperators {
    Unsupported,
    MySql,
    Sqlite,
    DuckDb,
}
Expand description

Whether a dialect treats MySQL’s reserved-keyword infix operators — DIV, MOD, XOR, RLIKE, REGEXP — as operators.

MySQL spells these infix operators as keywords rather than symbols; ANSI and PostgreSQL have none of them (the words are ordinary identifiers there). Which keywords act as operators is therefore an explicit dialect-data decision, the keyword analogue of PipeOperator/DoubleAmpersand: this maps a reserved keyword token to the canonical BinaryOperator it folds onto. Precedence is not stored here — each operator’s binding power is owned by the BindingPowerTable (DIV/MOD multiplicative, XOR between AND and OR, RLIKE/REGEXP comparison), so meaning and precedence cannot drift.

The MySql variant is named for a dialect, not the capability it grants — the lone place a FeatureSet value is dialect-named — and that is deliberate. A variant here denotes one dialect’s exact keyword-operator set (MySQL’s DIV/MOD/XOR/RLIKE/REGEXP mapping), which is a specification, not a composable capability: a future dialect with a different set gets its own variant rather than reusing this one, so the dialect name is the spec. A capability name like DivModXorRegexp would only restate that mapping, less precisely and with no room for the next dialect’s variant.

Variants§

§

Unsupported

No keyword infix operators (ANSI/PostgreSQL): DIV/MOD/XOR/RLIKE/REGEXP are ordinary identifiers, so in infix position they end the expression.

§

MySql

The MySQL keyword infix operators: DIV, MOD, XOR, RLIKE, REGEXP.

§

Sqlite

The SQLite keyword infix operators: GLOB, MATCH, REGEXP. Like MySql, the variant is named for the dialect whose exact keyword-operator set it denotes (a specification, not a composable capability), per the dialect-named-variant rationale documented on this enum. GLOB is a built-in the differential oracle can verify; MATCH/REGEXP are grammar hooks backed by application-defined functions the bundled engine does not register, so they parse but a bare prepare rejects them — grammar-only siblings.

§

DuckDb

DuckDB’s keyword infix set is just GLOB (engine-probed on 1.5.4: MATCH / REGEXP are not keyword infix operators there). Named for the dialect’s exact set, same rationale as Sqlite.

Implementations§

Source§

impl KeywordOperators

Source

pub const fn binary_operator(self, keyword: Keyword) -> Option<BinaryOperator>

The canonical binary operator keyword maps to as an infix operator under this dialect, or None when keyword is not a keyword operator here.

The MOD and RLIKE/REGEXP keywords fold onto the shared modulo/regex operators with a surface tag so the exact spelling round-trips; DIV and XOR are their own operator keys.

Trait Implementations§

Source§

impl Clone for KeywordOperators

Source§

fn clone(&self) -> KeywordOperators

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 Copy for KeywordOperators

Source§

impl Debug for KeywordOperators

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for KeywordOperators

Source§

impl PartialEq for KeywordOperators

Source§

fn eq(&self, other: &KeywordOperators) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for KeywordOperators

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