Skip to main content

ColumnIndex

Trait ColumnIndex 

Source
pub trait ColumnIndex<T>: Debug
where T: ?Sized,
{ // 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.

Caution: The column index may differ between a Statement and a Row returned by the statement. This can happen with some databases if, for example, the schema changes between prepare and execute or if the database does not provide column information when the statement is prepared.

Required Methodsยง

Source

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 &str

Sourceยง

fn index(&self, row: &AnyRow) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<AnyRow> for usize

Sourceยง

fn index(&self, row: &AnyRow) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<AnyStatement> for &str

Sourceยง

fn index(&self, statement: &AnyStatement) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<AnyStatement> for usize

Sourceยง

fn index(&self, statement: &AnyStatement) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<MySqlRow> for &str

Sourceยง

impl ColumnIndex<MySqlRow> for usize

Sourceยง

impl ColumnIndex<MySqlStatement> for &str

Sourceยง

fn index(&self, statement: &MySqlStatement) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<MySqlStatement> for usize

Sourceยง

fn index(&self, statement: &MySqlStatement) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<PgRow> for &str

Sourceยง

fn index(&self, row: &PgRow) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<PgRow> for usize

Sourceยง

fn index(&self, row: &PgRow) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<PgStatement> for &str

Sourceยง

fn index(&self, statement: &PgStatement) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<PgStatement> for usize

Sourceยง

fn index(&self, statement: &PgStatement) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<SqliteRow> for &str

Sourceยง

impl ColumnIndex<SqliteRow> for usize

Sourceยง

impl ColumnIndex<SqliteStatement> for &str

Sourceยง

fn index(&self, statement: &SqliteStatement) -> Result<usize, Error>

Sourceยง

impl ColumnIndex<SqliteStatement> for usize

Sourceยง

fn index(&self, statement: &SqliteStatement) -> Result<usize, Error>

Sourceยง

impl<T, I> ColumnIndex<T> for &I
where I: ColumnIndex<T> + ?Sized, T: ?Sized,

Sourceยง

fn index(&self, row: &T) -> Result<usize, Error>

Implementorsยง