Row

Trait Row 

pub trait Row:
    Unpin
    + Send
    + Sync
    + 'static {
    type Database: Database<Row = Self>;

    // Required method
    fn columns(&self) -> &[<Self::Database as Database>::Column];

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn len(&self) -> usize { ... }
    fn column<I>(&self, index: I) -> &<Self::Database as Database>::Column
       where I: ColumnIndex<Self> { ... }
    fn try_column<I>(
        &self,
        index: I,
    ) -> Result<&<Self::Database as Database>::Column, Error>
       where I: ColumnIndex<Self> { ... }
    fn get<'a, T, I>(&'a self, index: I) -> T
       where I: ColumnIndex<Self>,
             T: TryGetable<'a, Self::Database> { ... }
    fn try_get<'a, T, I>(&'a self, index: I) -> Result<T, Error>
       where I: ColumnIndex<Self>,
             T: TryGetable<'a, Self::Database> { ... }
}
Expand description

Represents a single row from the database.

Required Associated Types§

type Database: Database<Row = Self>

Required Methods§

fn columns(&self) -> &[<Self::Database as Database>::Column]

Gets all columns in this statement.

Provided Methods§

fn is_empty(&self) -> bool

Returns true if this row has no columns.

fn len(&self) -> usize

Returns the number of columns in this row.

fn column<I>(&self, index: I) -> &<Self::Database as Database>::Column
where I: ColumnIndex<Self>,

Gets the column information at index.

A string index can be used to access a column by name and a usize index can be used to access a column by position.

§Panics

Panics if index is out of bounds. See try_column for a non-panicking version.

fn try_column<I>( &self, index: I, ) -> Result<&<Self::Database as Database>::Column, Error>
where I: ColumnIndex<Self>,

Gets the column information at index or None if out of bounds.

fn get<'a, T, I>(&'a self, index: I) -> T
where I: ColumnIndex<Self>, T: TryGetable<'a, Self::Database>,

Index into the database row and decode a single value.

A string index can be used to access a column by name and a usize index can be used to access a column by position.

§Panics

Panics if the column does not exist or its value cannot be decoded into the requested type. See try_get for a non-panicking version.

fn try_get<'a, T, I>(&'a self, index: I) -> Result<T, Error>
where I: ColumnIndex<Self>, T: TryGetable<'a, Self::Database>,

Index into the database row and decode a single value.

A string index can be used to access a column by name and a usize index can be used to access a column by position.

§Errors

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§