Skip to main content

FromColumn

Trait FromColumn 

Source
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§

Source

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>

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for NaiveDate

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for String

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for Vec<u8>

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for bool

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for f64

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for i32

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for i64

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for u32

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Source§

impl FromColumn for u64

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

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.

Source§

fn from_column(row: &dyn Row, col: &str) -> Result<Self>

Implementors§