pub trait FromDrizzleRow<Row: ?Sized>: Sized {
const COLUMN_COUNT: usize;
// Required method
fn from_row_at(row: &Row, offset: usize) -> Result<Self, DrizzleError>;
// Provided method
fn from_row(row: &Row) -> Result<Self, DrizzleError> { ... }
}Expand description
Extracts a Rust value from a database row at a given column offset.
Unlike TryFrom<Row>, supports offset-based reading so joined results
can split a single row across multiple model types.
Tuple impls compose: (A, B) reads A at offset, then B at
offset + A::COLUMN_COUNT.
Required Associated Constants§
Sourceconst COLUMN_COUNT: usize
const COLUMN_COUNT: usize
Number of columns this type reads from the row.
Required Methods§
Sourcefn from_row_at(row: &Row, offset: usize) -> Result<Self, DrizzleError>
fn from_row_at(row: &Row, offset: usize) -> Result<Self, DrizzleError>
Read this type from row starting at column offset.
§Errors
Returns an error if any column from offset through
offset + COLUMN_COUNT - 1 cannot be read or converted.
Provided Methods§
Sourcefn from_row(row: &Row) -> Result<Self, DrizzleError>
fn from_row(row: &Row) -> Result<Self, DrizzleError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".