Trait mz_repr::fixed_length::FromRowByTypes
source · pub trait FromRowByTypes: Sized + Default {
// Required methods
fn from_datum_iter<'a, I, D>(
&mut self,
datum_iter: I,
types: Option<&[ColumnType]>
) -> Self
where I: IntoIterator<Item = D>,
D: Borrow<Datum<'a>>;
fn try_from_datum_iter<'a, I, D, E>(
&mut self,
datum_iter: I,
types: Option<&[ColumnType]>
) -> Result<Self, E>
where I: IntoIterator<Item = Result<D, E>>,
D: Borrow<Datum<'a>>;
// Provided method
fn from_row(&mut self, row: Row, types: Option<&[ColumnType]>) -> Self { ... }
}
Expand description
A helper trait to construct target values from input Row
instances based on type
information that only manifests at runtime (typically originating from inferred schemas).
Typically, the target type will be of fixed-length without tags per column or Row
itself.
Required Methods§
sourcefn from_datum_iter<'a, I, D>(
&mut self,
datum_iter: I,
types: Option<&[ColumnType]>
) -> Self
fn from_datum_iter<'a, I, D>( &mut self, datum_iter: I, types: Option<&[ColumnType]> ) -> Self
Obtains an instance of Self' given an iterator of borrowed datums and a schema provided by
types`.
Implementations are free to place specific requirements on the given schema.
sourcefn try_from_datum_iter<'a, I, D, E>(
&mut self,
datum_iter: I,
types: Option<&[ColumnType]>
) -> Result<Self, E>
fn try_from_datum_iter<'a, I, D, E>( &mut self, datum_iter: I, types: Option<&[ColumnType]> ) -> Result<Self, E>
Obtains an instance of Self' given an iterator of results of borrowed datums and a schema provided by
types`.
Implementations are free to place specific requirements on the given schema.
In the case the iterator produces an error, the pushing of datums is terminated and the error returned.
Provided Methods§
sourcefn from_row(&mut self, row: Row, types: Option<&[ColumnType]>) -> Self
fn from_row(&mut self, row: Row, types: Option<&[ColumnType]>) -> Self
Obtains an instance of Self
given an instance of Row
and a schema provided
by types
.
Implementations are free to place specific requirements on the given schema.
Object Safety§
Implementations on Foreign Types§
source§impl FromRowByTypes for ()
impl FromRowByTypes for ()
source§fn from_row(&mut self, row: Row, types: Option<&[ColumnType]>) -> Self
fn from_row(&mut self, row: Row, types: Option<&[ColumnType]>) -> Self
Obtains a unit value from an empty Row
.
This implementation panics if types
other than Some(&[])
are provided. This is because
unit values need to have an empty schema.
source§fn from_datum_iter<'a, I, D>(
&mut self,
datum_iter: I,
types: Option<&[ColumnType]>
) -> Self
fn from_datum_iter<'a, I, D>( &mut self, datum_iter: I, types: Option<&[ColumnType]> ) -> Self
Obtains a unit value from an empty datum iterator.
This implementation panics if types
other than Some(&[])
are provided. This is because
unit values need to have an empty schema.
source§fn try_from_datum_iter<'a, I, D, E>(
&mut self,
datum_iter: I,
types: Option<&[ColumnType]>
) -> Result<Self, E>
fn try_from_datum_iter<'a, I, D, E>( &mut self, datum_iter: I, types: Option<&[ColumnType]> ) -> Result<Self, E>
Obtains a unit value from an empty iterator of results of datums.
This implementation panics if types
other than Some(&[])
are provided. This is because
unit values need to have an empty schema.