Skip to main content

ComparisonOperand

Trait ComparisonOperand 

Source
pub trait ComparisonOperand<'a, V, L>: Sized
where V: SQLParam + 'a, L: Expr<'a, V>,
{ type SQLType: DataType; type Aggregate: AggregateKind; // Required method fn into_comparison_sql(self) -> SQL<'a, V>; }
Expand description

Type-safe operand for comparison functions.

This trait exists as an indirection layer between comparison functions (eq, gt, like, etc.) and the Expr trait. Rather than accepting any Expr directly, comparisons require ComparisonOperand<'a, V, L> where L is the left-hand expression type.

The blanket impl below only fires when L::SQLType: Compatible<R::SQLType>. Table macros can also implement this trait for custom column value types and a specific generated column ZST, which enables eq(table.custom, value) without making the value type a global SQL expression.

Required Associated Types§

Required Methods§

Source

fn into_comparison_sql(self) -> SQL<'a, V>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, V, L, R> ComparisonOperand<'a, V, L> for R
where V: SQLParam + 'a, L: Expr<'a, V>, R: Expr<'a, V>, L::SQLType: Compatible<R::SQLType>,

Source§

type SQLType = <R as Expr<'a, V>>::SQLType

Source§

type Aggregate = <R as Expr<'a, V>>::Aggregate