Skip to main content

FromRow

Trait FromRow 

Source
pub trait FromRow<R, E> {
    // Required methods
    fn forward<'a, I>(iter: &mut I) -> Result<usize, E>
       where I: Iterator<Item = &'a Select>,
             Self: Sized;
    fn from_row<'a, I>(
        row: &R,
        index: &mut usize,
        iter: &mut I,
    ) -> Result<Option<Self>, E>
       where I: Iterator<Item = &'a Select> + Clone,
             Self: Sized;
}
Expand description

This is implemented by Toql Derive for all dervied structs with generic row and error. The implementation of primitive types with concrete row and error type must be done by the database crate.

Required Methods§

Source

fn forward<'a, I>(iter: &mut I) -> Result<usize, E>
where I: Iterator<Item = &'a Select>, Self: Sized,

Returns the number of selects This is needed to advance the iterator and the row index. The Deserializer needs this information to skip left joins that have fields selected but are null. Those left joins cause select information in the select stream that must be skipped.

Source

fn from_row<'a, I>( row: &R, index: &mut usize, iter: &mut I, ) -> Result<Option<Self>, E>
where I: Iterator<Item = &'a Select> + Clone, Self: Sized,

Read row values into struct, starting from index. Advances iter and index Returns None for value unselected values or joined entities that have null keys. Return Error, if value is selected, but cannot be converted.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FromRow<Row, ToqlError> for String

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<String>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for bool

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<bool>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for f64

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<f64>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for i8

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<i8>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for i16

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<i16>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for i32

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<i32>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for i64

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<i64>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for u8

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<u8>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for u16

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<u16>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for u32

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<u32>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Source§

impl FromRow<Row, ToqlError> for u64

Source§

fn forward<'a, I>(iter: &mut I) -> Result<usize, ToqlError>
where I: Iterator<Item = &'a Select>,

Source§

fn from_row<'a, I>( row: &Row, i: &mut usize, iter: &mut I, ) -> Result<Option<u64>, ToqlError>
where I: Iterator<Item = &'a Select> + Clone,

Implementors§

Source§

impl<R, E> FromRow<R, E> for SqlArg
where E: From<ToqlError>, u64: FromRow<R, E>, i64: FromRow<R, E>, f64: FromRow<R, E>, bool: FromRow<R, E>, String: FromRow<R, E>,

Source§

impl<T, R, E> FromRow<R, E> for Join<T>
where T: Keyed + FromRow<R, E>, E: From<ToqlError>,