mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Seal the RowIndex
trait (technically breaking, but unlikely to break anybody)
This commit is contained in:
parent
b9ccb252ef
commit
c45446ba73
12
src/row.rs
12
src/row.rs
@ -346,8 +346,18 @@ impl<'stmt> Row<'stmt> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod sealed {
|
||||||
|
/// This trait exists just to ensure that the only impls of `trait Params`
|
||||||
|
/// that are allowed are ones in this crate.
|
||||||
|
pub trait Sealed {}
|
||||||
|
impl Sealed for usize {}
|
||||||
|
impl Sealed for &str {}
|
||||||
|
}
|
||||||
|
|
||||||
/// A trait implemented by types that can index into columns of a row.
|
/// A trait implemented by types that can index into columns of a row.
|
||||||
pub trait RowIndex {
|
///
|
||||||
|
/// It is only implemented for `usize` and `&str`.
|
||||||
|
pub trait RowIndex: sealed::Sealed {
|
||||||
/// Returns the index of the appropriate column, or `None` if no such
|
/// Returns the index of the appropriate column, or `None` if no such
|
||||||
/// column exists.
|
/// column exists.
|
||||||
fn idx(&self, stmt: &Statement<'_>) -> Result<usize>;
|
fn idx(&self, stmt: &Statement<'_>) -> Result<usize>;
|
||||||
|
Loading…
Reference in New Issue
Block a user