pub trait ColumnIndex<T: ?Sized>: Sealed + Debug {
// Required method
fn index(&self, container: &T) -> Result<usize, Error>;
}Expand description
A type that can be used to index into a Row or Statement.
The get and try_get methods of Row accept any type that implements ColumnIndex.
This trait is implemented for strings which are used to look up a column by name, and for
usize which is used as a positional index into the row.
This trait is sealed and cannot be implemented for types outside of SQLx.
Required Methods§
Sourcefn index(&self, container: &T) -> Result<usize, Error>
fn index(&self, container: &T) -> Result<usize, Error>
Returns a valid positional index into the row or statement, ColumnIndexOutOfBounds, or,
ColumnNotFound.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ColumnIndex<AnyRow> for usize
Available on crate feature any and (crate features mssql or mysql or postgres or sqlite) only.
impl ColumnIndex<AnyRow> for usize
Available on crate feature
any and (crate features mssql or mysql or postgres or sqlite) only.Source§impl ColumnIndex<AnyStatement<'_>> for usize
Available on crate feature any and (crate features mssql or mysql or postgres or sqlite) only.
impl ColumnIndex<AnyStatement<'_>> for usize
Available on crate feature
any and (crate features mssql or mysql or postgres or sqlite) only.Source§impl ColumnIndex<MssqlRow> for &str
Available on crate feature mssql only.
impl ColumnIndex<MssqlRow> for &str
Available on crate feature
mssql only.Source§impl ColumnIndex<MssqlRow> for usize
Available on crate feature mssql only.
impl ColumnIndex<MssqlRow> for usize
Available on crate feature
mssql only.Source§impl ColumnIndex<MssqlStatement<'_>> for &str
Available on crate feature mssql only.
impl ColumnIndex<MssqlStatement<'_>> for &str
Available on crate feature
mssql only.Source§impl ColumnIndex<MssqlStatement<'_>> for usize
Available on crate feature mssql only.
impl ColumnIndex<MssqlStatement<'_>> for usize
Available on crate feature
mssql only.Source§impl ColumnIndex<MySqlRow> for &str
Available on crate feature mysql only.
impl ColumnIndex<MySqlRow> for &str
Available on crate feature
mysql only.Source§impl ColumnIndex<MySqlRow> for usize
Available on crate feature mysql only.
impl ColumnIndex<MySqlRow> for usize
Available on crate feature
mysql only.Source§impl ColumnIndex<MySqlStatement<'_>> for &str
Available on crate feature mysql only.
impl ColumnIndex<MySqlStatement<'_>> for &str
Available on crate feature
mysql only.Source§impl ColumnIndex<MySqlStatement<'_>> for usize
Available on crate feature mysql only.
impl ColumnIndex<MySqlStatement<'_>> for usize
Available on crate feature
mysql only.Source§impl ColumnIndex<PgRow> for &str
Available on crate feature postgres only.
impl ColumnIndex<PgRow> for &str
Available on crate feature
postgres only.Source§impl ColumnIndex<PgRow> for usize
Available on crate feature postgres only.
impl ColumnIndex<PgRow> for usize
Available on crate feature
postgres only.Source§impl ColumnIndex<PgStatement<'_>> for &str
Available on crate feature postgres only.
impl ColumnIndex<PgStatement<'_>> for &str
Available on crate feature
postgres only.Source§impl ColumnIndex<PgStatement<'_>> for usize
Available on crate feature postgres only.
impl ColumnIndex<PgStatement<'_>> for usize
Available on crate feature
postgres only.Source§impl ColumnIndex<SqliteRow> for &str
Available on crate feature sqlite only.
impl ColumnIndex<SqliteRow> for &str
Available on crate feature
sqlite only.Source§impl ColumnIndex<SqliteRow> for usize
Available on crate feature sqlite only.
impl ColumnIndex<SqliteRow> for usize
Available on crate feature
sqlite only.Source§impl ColumnIndex<SqliteStatement<'_>> for &str
Available on crate feature sqlite only.
impl ColumnIndex<SqliteStatement<'_>> for &str
Available on crate feature
sqlite only.Source§impl ColumnIndex<SqliteStatement<'_>> for usize
Available on crate feature sqlite only.
impl ColumnIndex<SqliteStatement<'_>> for usize
Available on crate feature
sqlite only.Source§impl<'i> ColumnIndex<AnyRow> for &'i strwhere
&'i str: AnyColumnIndex,
Available on crate feature any and (crate features mssql or mysql or postgres or sqlite) only.
impl<'i> ColumnIndex<AnyRow> for &'i strwhere
&'i str: AnyColumnIndex,
Available on crate feature
any and (crate features mssql or mysql or postgres or sqlite) only.Source§impl<'i> ColumnIndex<AnyStatement<'_>> for &'i strwhere
&'i str: AnyColumnIndex,
Available on crate feature any and (crate features mssql or mysql or postgres or sqlite) only.
impl<'i> ColumnIndex<AnyStatement<'_>> for &'i strwhere
&'i str: AnyColumnIndex,
Available on crate feature
any and (crate features mssql or mysql or postgres or sqlite) only.