Skip to main content

FromDatum

Trait FromDatum 

Source
pub trait FromDatum<'a>:
    Sized
    + PartialEq
    + Borrow<Datum<'a>>
    + Sealed {
    // Required method
    fn from_datum(datum: Datum<'a>) -> Self;
}
Expand description

Infallible conversion from a Datum to a typed value.

Used by DatumList::typed_iter to yield elements as T rather than raw Datums. At runtime, T is always Datum<'a>, so the conversion is identity.

See doc/developer/design/20260311_sqlfunc_generic.md for the design behind the generic type parameter and type erasure.

This trait is sealed and cannot be implemented outside of this crate.

Required Methods§

Source

fn from_datum(datum: Datum<'a>) -> Self

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.

Implementors§

Source§

impl<'a> FromDatum<'a> for Datum<'a>