pub trait FromColumn: Sized {
// Required method
fn from_column(row: &dyn Row, col: &str) -> Result<Self>;
}Expand description
Decodes one column of a Row into a Rust value. The generated decoder
calls T::from_column(row, "col")? per field. The bare T impls treat a
NULL as a decode error; the blanket Option<T> impl below turns it into
None.
Required Methods§
fn from_column(row: &dyn Row, col: &str) -> Result<Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl FromColumn for DateTime<Utc>
impl FromColumn for DateTime<Utc>
Source§impl FromColumn for NaiveDate
impl FromColumn for NaiveDate
Source§impl FromColumn for String
impl FromColumn for String
Source§impl FromColumn for bool
impl FromColumn for bool
Source§impl FromColumn for f64
impl FromColumn for f64
Source§impl FromColumn for i32
impl FromColumn for i32
Source§impl FromColumn for i64
impl FromColumn for i64
Source§impl FromColumn for u32
impl FromColumn for u32
Source§impl FromColumn for u64
impl FromColumn for u64
Source§impl<T: FromColumn + SqlType> FromColumn for Option<T>
Blanket nullability: any decodable, typed column is decodable as Option.
Living in this crate (not a per-type macro) keeps it coherent — a custom
type gets Option support for free from its bare FromColumn + SqlType,
without a downstream impl … for Option<Custom> (which the orphan rule
forbids). Presence is probed through the getter matching the type’s
ColumnType; only a present cell is decoded.
impl<T: FromColumn + SqlType> FromColumn for Option<T>
Blanket nullability: any decodable, typed column is decodable as Option.
Living in this crate (not a per-type macro) keeps it coherent — a custom
type gets Option support for free from its bare FromColumn + SqlType,
without a downstream impl … for Option<Custom> (which the orphan rule
forbids). Presence is probed through the getter matching the type’s
ColumnType; only a present cell is decoded.