Skip to content

Commit

Permalink
Adjust the docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed Apr 24, 2024
1 parent 9b59622 commit 8b4e570
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct Row {

/// A type suitable for indexing columns in a row.
pub trait RowIndex: std::fmt::Debug {
/// Check if the row contains a column.
/// Check if the index is present in a row.
fn contains(&self, row: &Row) -> bool;

/// Identify the ordinal position.
Expand Down Expand Up @@ -132,6 +132,17 @@ impl<'l> From<CursorWithOwnership<'l>> for Statement<'l> {
}

impl Row {
/// Check if the row contains a column.
///
/// In case of integer indices, the first column has index 0.
#[inline]
pub fn contains<T>(&self, column: T) -> bool
where
T: RowIndex,
{
column.contains(self)
}

/// Read the value in a column.
///
/// In case of integer indices, the first column has index 0.
Expand Down Expand Up @@ -172,17 +183,6 @@ impl Row {
{
T::try_from(&self.values[column.index(self)])
}

/// Check to see if a given column exists within the row.
///
/// In case of integer indices, the first column has index 0.
#[inline]
pub fn contains<U>(&self, column: U) -> bool
where
U: RowIndex,
{
column.contains(self)
}
}

impl From<Row> for Vec<Value> {
Expand Down

0 comments on commit 8b4e570

Please sign in to comment.