Trait butane::FromSql

source ·
pub trait FromSql {
    // Required method
    fn from_sql_ref(val: SqlValRef<'_>) -> Result<Self, Error>
       where Self: Sized;

    // Provided method
    fn from_sql(val: SqlVal) -> Result<Self, Error>
       where Self: Sized { ... }
}
Expand description

Used to convert a SqlVal or SqlValRef into another type.

The SqlVal is consumed.

Required Methods§

source

fn from_sql_ref(val: SqlValRef<'_>) -> Result<Self, Error>where Self: Sized,

Used to convert a SqlValRef into another type.

Provided Methods§

source

fn from_sql(val: SqlVal) -> Result<Self, Error>where Self: Sized,

Used to convert a SqlVal into another type. The default implementation calls Self::from_sql_ref(val.as_ref()), which may be inefficient. This method is chiefly used only for primary keys: a more efficient implementation is unlikely to provide benefits for types not used as primary keys.

Implementations on Foreign Types§

source§

impl FromSql for String

source§

impl<T> FromSql for HashMap<String, T, RandomState>where T: Clone + PartialEq<T> + for<'a> Deserialize<'a>,

source§

impl FromSql for f64

source§

impl FromSql for NaiveDateTime

source§

impl FromSql for u32

source§

impl FromSql for Uuid

source§

impl FromSql for bool

source§

impl FromSql for u16

source§

impl<T> FromSql for Option<T>where T: FromSql,

source§

impl FromSql for DateTime<Utc>

source§

impl FromSql for i64

source§

impl FromSql for Vec<u8, Global>

source§

impl FromSql for i16

source§

impl FromSql for u8

source§

impl FromSql for f32

source§

impl FromSql for Value

source§

impl FromSql for i32

source§

impl FromSql for i8

Implementors§

source§

impl<T> FromSql for ForeignKey<T>where T: DataObject,