diesel::prelude

Trait PreferredBoolSqlType

source
pub trait PreferredBoolSqlType {
    type PreferredSqlType;
}
Expand description

Allow ~type inference on And and Or helper types

This is used to be statistically correct as last generic parameter of dsl::And and dsl::Or without having to specify an additional type parameter.

It works with types that are Expressions and have a SqlType that is either Bool or Nullable<Bool>, and with bool (and Option<bool> and references to those).

Cases where an additional type parameter would still have to be specified in the helper type generic parameters are:

  • If this trait isn’t implemented for the other parameter of the expression (in that case the user (you?) probably wants to implement it)
  • If the user actually was using the not-preferred implementation of AsExpression (e.g. towards Nullable<Bool> instead of Bool)

Required Associated Types§

source

type PreferredSqlType

The preferred Bool SQL type for this AsExpression implementation.

That should be either Bool or Nullable<Bool>.

Implementations on Foreign Types§

source§

impl PreferredBoolSqlType for &&Option<bool>

source§

impl PreferredBoolSqlType for &&bool

source§

impl PreferredBoolSqlType for &Option<bool>

source§

impl PreferredBoolSqlType for &bool

source§

impl PreferredBoolSqlType for Option<bool>

source§

impl PreferredBoolSqlType for bool

This impl has to live in Diesel because otherwise it would conflict with the blanket impl above because “diesel might add an implementation of Expression for bool”

Implementors§