Skip to main content

RowAccess

Trait RowAccess 

Source
pub trait RowAccess<'row> {
    // Required methods
    fn get_by_pos(&'row self, idx: usize) -> Option<&'row Value>;
    fn get(&'row self, name: &str) -> Option<&'row Value>;
    fn column_name(&'row self, idx: usize) -> Option<&'row str>;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Trait for abstracting row data access with lifetime support.

This trait allows both borrowed and owned row implementations, enabling database-specific optimizations while maintaining a common interface.

Required Methods§

Source

fn get_by_pos(&'row self, idx: usize) -> Option<&'row Value>

Get a value by column position (0-indexed).

Returns None if the position is out of bounds.

Source

fn get(&'row self, name: &str) -> Option<&'row Value>

Get a value by column name.

Returns None if the column doesn’t exist.

Source

fn column_name(&'row self, idx: usize) -> Option<&'row str>

Get the column name at the given position.

Returns None if the position is out of bounds.

Source

fn len(&self) -> usize

Returns the number of columns in the row.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the row contains no columns.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§