Skip to main content

IntoLiteral

Trait IntoLiteral 

Source
pub trait IntoLiteral {
    // Required method
    fn into_literal(self) -> Expr;
}
Expand description

Conversion trait for types that can be turned into a SQL literal Expr.

This trait is used by lit() to accept various Rust primitive types and convert them into the appropriate SQL literal representation.

Implemented for:

  • &str, String – produce a SQL string literal (e.g. 'hello').
  • i32, i64, usize, f64 – produce a SQL numeric literal (e.g. 42, 3.14).
  • bool – produce a SQL boolean literal (TRUE or FALSE).

Required Methods§

Source

fn into_literal(self) -> Expr

Convert this value into a literal Expr.

Implementations on Foreign Types§

Source§

impl IntoLiteral for &str

Source§

fn into_literal(self) -> Expr

Produce a SQL string literal (e.g. 'hello').

Source§

impl IntoLiteral for bool

Source§

fn into_literal(self) -> Expr

Produce a SQL boolean literal (TRUE or FALSE).

Source§

impl IntoLiteral for f64

Source§

fn into_literal(self) -> Expr

Produce a SQL numeric literal from a 64-bit float.

Source§

impl IntoLiteral for i32

Source§

fn into_literal(self) -> Expr

Produce a SQL numeric literal from a 32-bit integer.

Source§

impl IntoLiteral for i64

Source§

fn into_literal(self) -> Expr

Produce a SQL numeric literal from a 64-bit integer.

Source§

impl IntoLiteral for usize

Source§

fn into_literal(self) -> Expr

Produce a SQL numeric literal from a usize.

Source§

impl IntoLiteral for String

Source§

fn into_literal(self) -> Expr

Produce a SQL string literal from an owned string.

Implementors§