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§
Sourcefn forward<'a, I>(iter: &mut I) -> Result<usize, E>
fn forward<'a, I>(iter: &mut I) -> Result<usize, E>
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.
Sourcefn from_row<'a, I>(
row: &R,
index: &mut usize,
iter: &mut I,
) -> Result<Option<Self>, E>
fn from_row<'a, I>( row: &R, index: &mut usize, iter: &mut I, ) -> Result<Option<Self>, E>
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".