pub trait Table: Sized {
// Required method
fn from_row(row: &Row<'_>) -> Result<Self>;
// Provided methods
fn rows<'stmt, P: Params>(
stmt: &'stmt mut Statement<'_>,
params: P,
) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>
where Self: 'stmt { ... }
fn row<P: Params>(
stmt: &mut Statement<'_>,
params: P,
) -> Result<Self, TableError> { ... }
}Expand description
Required Methods§
Sourcefn from_row(row: &Row<'_>) -> Result<Self>
fn from_row(row: &Row<'_>) -> Result<Self>
Deserialize a single row into Self. Returns rusqlite::Result
for direct use inside rusqlite::query_map / query_row
callbacks. For high-level iteration, prefer Table::rows or
Table::row.
Provided Methods§
Sourcefn rows<'stmt, P: Params>(
stmt: &'stmt mut Statement<'_>,
params: P,
) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>where
Self: 'stmt,
fn rows<'stmt, P: Params>(
stmt: &'stmt mut Statement<'_>,
params: P,
) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>where
Self: 'stmt,
Iterate over the results of stmt, deserializing each row through
from_row. Return TableError for both fetch and
deserialization failures. Pass either a rusqlite::Statement or a
rusqlite::CachedStatement (via deref coercion).
Sourcefn row<P: Params>(
stmt: &mut Statement<'_>,
params: P,
) -> Result<Self, TableError>
fn row<P: Params>( stmt: &mut Statement<'_>, params: P, ) -> Result<Self, TableError>
Fetch exactly one row from stmt. Returns
TableError::QueryError if the row is missing or fails to
deserialize. Accepts both rusqlite::Statement and
rusqlite::CachedStatement (the latter via deref coercion).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".