pub trait IntoFieldType {
    type ElementType;

    const TYPE_INFO_TYPE: TypeInfoType;

    // Required method
    fn into_field_type(self) -> Option<Self::ElementType>;
}
Expand description

Indicates that a type can be converted to one that is FieldType, and holds associated metadata.

For example, DateTime<T>s are valid Field values, but must first be converted to nanoseconds-since-the-epoch in i64 values; the original type and corresponding TypeInfoType is stored here.

This trait mainly exists to enable smoother APIs when creating Fields.

Required Associated Types§

source

type ElementType

The type to which Self will be converted when storing values in a Field.

Required Associated Constants§

source

const TYPE_INFO_TYPE: TypeInfoType

The corresponding TypeInfoType for this original data type.

Required Methods§

source

fn into_field_type(self) -> Option<Self::ElementType>

Convert this type into an (optional) field type.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl IntoFieldType for bool

source§

impl IntoFieldType for f32

§

type ElementType = f32

source§

const TYPE_INFO_TYPE: TypeInfoType = TypeInfoType::Float32

source§

fn into_field_type(self) -> Option<Self::ElementType>

source§

impl IntoFieldType for f64

§

type ElementType = f64

source§

const TYPE_INFO_TYPE: TypeInfoType = TypeInfoType::Float64

source§

fn into_field_type(self) -> Option<Self::ElementType>

source§

impl IntoFieldType for i8

source§

impl IntoFieldType for i16

source§

impl IntoFieldType for i32

source§

impl IntoFieldType for i64

source§

impl IntoFieldType for u8

source§

impl IntoFieldType for u16

§

type ElementType = u16

source§

const TYPE_INFO_TYPE: TypeInfoType = TypeInfoType::UInt16

source§

fn into_field_type(self) -> Option<Self::ElementType>

source§

impl IntoFieldType for u32

§

type ElementType = u32

source§

const TYPE_INFO_TYPE: TypeInfoType = TypeInfoType::UInt32

source§

fn into_field_type(self) -> Option<Self::ElementType>

source§

impl IntoFieldType for u64

§

type ElementType = u64

source§

const TYPE_INFO_TYPE: TypeInfoType = TypeInfoType::UInt64

source§

fn into_field_type(self) -> Option<Self::ElementType>

source§

impl IntoFieldType for String

source§

impl IntoFieldType for SystemTime

source§

impl IntoFieldType for NaiveDate

source§

impl IntoFieldType for NaiveDateTime

source§

impl<'a> IntoFieldType for &'a str

§

type ElementType = &'a str

source§

const TYPE_INFO_TYPE: TypeInfoType = TypeInfoType::String

source§

fn into_field_type(self) -> Option<Self::ElementType>

source§

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

§

type ElementType = T

source§

const TYPE_INFO_TYPE: TypeInfoType = T::TYPE_INFO_TYPE

source§

fn into_field_type(self) -> Option<Self::ElementType>

source§

impl<T> IntoFieldType for Date<T>
where T: Offset + TimeZone,

source§

impl<T> IntoFieldType for DateTime<T>
where T: Offset + TimeZone,

Implementors§