Trait mule::Typer[][src]

pub trait Typer: Default {
    type TypeTag: Display + Hash + Eq + Copy;
    type Output: TypedValue<Self::TypeTag>;
    fn type_value(&self, value: &RawValue) -> Self::Output;
fn type_value_as(
        &self,
        value: &RawValue,
        tag: Self::TypeTag
    ) -> ColumnValue<Self::Output>; }

Infer the type of a raw value

Associated Types

type TypeTag: Display + Hash + Eq + Copy[src]

Uniquely-identifying tag type for typed values

type Output: TypedValue<Self::TypeTag>[src]

The type of a fully-typed single value

Loading content...

Required methods

fn type_value(&self, value: &RawValue) -> Self::Output[src]

Parse a raw value into a specialized typed value

This method should never fail. Your type should have a fallback variant to be used when no appropriate concrete was detected (like a Text variant).

fn type_value_as(
    &self,
    value: &RawValue,
    tag: Self::TypeTag
) -> ColumnValue<Self::Output>
[src]

Parse a raw value into a specific type. This should fail by parsing into ColumnValue::Invalid when the specified type tag could not be used to parse the raw value.

Loading content...

Implementors

impl Typer for DefaultTyper[src]

type TypeTag = ValueType

type Output = Value

Loading content...