pub trait FromColumn: Sized {
// Required method
fn from_column(row: &impl RowRef, column: &str) -> Result<Self, RowError>;
}Expand description
Trait for types that can be extracted from a column.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl FromColumn for Value
impl FromColumn for Value
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 String
impl FromColumn for String
Source§impl FromColumn for Vec<f32>
Dense pgvector columns decode into Vec<f32>. The schema-generated
client uses this for Vector(N) and HalfVector(N) scalar fields.
The underlying driver implements RowRef::get_vector — drivers that
don’t have a pgvector binding will surface an unsupported error
at query time rather than at compile time.
impl FromColumn for Vec<f32>
Dense pgvector columns decode into Vec<f32>. The schema-generated
client uses this for Vector(N) and HalfVector(N) scalar fields.
The underlying driver implements RowRef::get_vector — drivers that
don’t have a pgvector binding will surface an unsupported error
at query time rather than at compile time.
Source§impl FromColumn for Vec<u8>
impl FromColumn for Vec<u8>
Source§impl FromColumn for DateTime<Utc>
impl FromColumn for DateTime<Utc>
Source§impl FromColumn for NaiveDate
impl FromColumn for NaiveDate
Source§impl FromColumn for NaiveDateTime
impl FromColumn for NaiveDateTime
Source§impl FromColumn for NaiveTime
impl FromColumn for NaiveTime
Source§impl FromColumn for Decimal
impl FromColumn for Decimal
Source§impl FromColumn for Uuid
impl FromColumn for Uuid
Source§impl<T: FromColumn> FromColumn for Option<T>
Blanket impl so every FromColumn type also satisfies
FromColumn through Option<T> without each consumer needing a
hand-written nullable wrapper — schema-generated enum types can’t
write their own impl FromColumn for Option<MyEnum> because of the
orphan rule (both Option and FromColumn are foreign from the
consumer crate’s perspective).
impl<T: FromColumn> FromColumn for Option<T>
Blanket impl so every FromColumn type also satisfies
FromColumn through Option<T> without each consumer needing a
hand-written nullable wrapper — schema-generated enum types can’t
write their own impl FromColumn for Option<MyEnum> because of the
orphan rule (both Option and FromColumn are foreign from the
consumer crate’s perspective).
Uses RowRef::is_null to short-circuit null rows to None; the
non-null path delegates to T::from_column. Drivers that had a
faster native Option<primitive> path previously now go through
this blanket — the extra is_null round-trip is a small
per-column cost in exchange for the orphan-rule unblock.