pub struct Row { /* private fields */ }Expand description
A database row containing column values
Row provides methods for accessing and manipulating column values while maintaining type safety and consistency with the schema.
§Performance
Sharedstorage: O(1) clone (just Arc increment)Ownedstorage: O(n) clone (copies values)- String values use SmartString with internal Arc
for efficient sharing
Implementations§
Source§impl Row
impl Row
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a row with pre-allocated capacity
Sourcepub fn from_values(values: Vec<Value>) -> Self
pub fn from_values(values: Vec<Value>) -> Self
Create a row from a vector of values
Sourcepub fn from_compact_vec(values: CompactVec<Value>) -> Self
pub fn from_compact_vec(values: CompactVec<Value>) -> Self
Create a row from CompactVec
Sourcepub fn from_arc(values: CompactArc<[Value]>) -> Self
pub fn from_arc(values: CompactArc<[Value]>) -> Self
Create a row from an Arc slice - O(1), no copying
Sourcepub fn from_combined(left: &Row, right: &Row) -> Self
pub fn from_combined(left: &Row, right: &Row) -> Self
Create a row by combining two rows (for JOINs) Result uses Owned storage (optimal for intermediate results)
Sourcepub fn combine_into(&mut self, left: &Row, right: &Row)
pub fn combine_into(&mut self, left: &Row, right: &Row)
Combine two rows into this row buffer (for JOINs) - reuses allocation
Sourcepub fn combine_into_clone_move(&mut self, left: &Row, right: Row)
pub fn combine_into_clone_move(&mut self, left: &Row, right: Row)
Combine rows: clone left, move right (for JOINs) - reuses allocation
Sourcepub fn combine_into_owned(&mut self, left: Row, right: Row)
pub fn combine_into_owned(&mut self, left: Row, right: Row)
Combine rows: move both (for JOINs) - reuses allocation
Sourcepub fn from_combined_clone_move(left: &Row, right: Row) -> Self
pub fn from_combined_clone_move(left: &Row, right: Row) -> Self
Combine rows: clone left, move right (for JOINs)
Sourcepub fn from_combined_owned(left: Row, right: Row) -> Self
pub fn from_combined_owned(left: Row, right: Row) -> Self
Combine two owned rows (for JOINs) - moves values without cloning
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut Value>
pub fn get_mut(&mut self, index: usize) -> Option<&mut Value>
Get a mutable value by index (triggers copy-on-write if shared)
Sourcepub fn set(&mut self, index: usize, value: Value) -> Result<()>
pub fn set(&mut self, index: usize, value: Value) -> Result<()>
Set a value at the given index (triggers copy-on-write if shared)
Sourcepub fn take_and_clear(&mut self) -> Row
pub fn take_and_clear(&mut self) -> Row
Take the values from this row, returning them in a new Row. The original row is cleared but keeps its allocated capacity.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve capacity for at least additional more values
Sourcepub fn extend_from_slice(&mut self, other: &[Value])
pub fn extend_from_slice(&mut self, other: &[Value])
Extend the row with values from a slice
Sourcepub fn extend_into_compact_vec(self, target: &mut CompactVec<Value>)
pub fn extend_into_compact_vec(self, target: &mut CompactVec<Value>)
Extend a CompactVec with this row’s values, consuming self.
OPTIMIZATION: This avoids the intermediate Vec allocation that would occur
with target.extend(row) which goes through Row::into_iter().
- Owned storage: directly extends from CompactVec (moves values)
- Shared storage: clones values from Arc slice
Sourcepub fn iter_mut(&mut self) -> RowIterMut<'_> ⓘ
pub fn iter_mut(&mut self) -> RowIterMut<'_> ⓘ
Get a mutable iterator over the values (triggers copy-on-write if shared)
Sourcepub fn into_values(self) -> Vec<Value>
pub fn into_values(self) -> Vec<Value>
Get the underlying vector of values, consuming the row
Sourcepub fn take_first_value(self) -> Option<Value>
pub fn take_first_value(self) -> Option<Value>
Extract the first value, consuming the row
Check if storage is shared (Arc-wrapped)
Sourcepub fn into_arc(self) -> CompactArc<[Value]>
pub fn into_arc(self) -> CompactArc<[Value]>
Convert Row to CompactArc<Value>, consuming self
- Shared: returns the CompactArc directly (O(1))
- Owned: creates new Arc (O(n))
Convert to Shared storage for O(1) clone.
Use this when the row will be cloned multiple times (e.g., hash join build side).
After conversion, row.clone() is just an Arc increment.
Sourcepub fn as_arc(&self) -> Option<&CompactArc<[Value]>>
pub fn as_arc(&self) -> Option<&CompactArc<[Value]>>
Get CompactArc<Value> reference if shared, None if owned
Sourcepub fn select_columns(&self, indices: &[usize]) -> Result<Row>
pub fn select_columns(&self, indices: &[usize]) -> Result<Row>
Extract specific columns by their indices
Sourcepub fn take_columns(self, indices: &[usize]) -> Row
pub fn take_columns(self, indices: &[usize]) -> Row
Take specific columns by their indices, consuming the row Detects prefix projections (0, 1, 2, …, n-1) and truncates in-place.
Sourcepub fn clone_subset(&self, indices: &[usize]) -> Row
pub fn clone_subset(&self, indices: &[usize]) -> Row
Clone the row, selecting only the specified column indices
Sourcepub fn clear_inline(&mut self)
pub fn clear_inline(&mut self)
Clear and use as inline storage (backwards compatibility)
Sourcepub fn push_inline(&mut self, value: Value)
pub fn push_inline(&mut self, value: Value)
Push to inline storage (backwards compatibility)
Sourcepub fn reserve_inline(&mut self, capacity: usize)
pub fn reserve_inline(&mut self, capacity: usize)
Reserve inline capacity (backwards compatibility)
Sourcepub fn refill_inline<I: Iterator<Item = Value>>(&mut self, values: I)
pub fn refill_inline<I: Iterator<Item = Value>>(&mut self, values: I)
Refill with values (backwards compatibility)
Trait Implementations§
Source§impl From<CompactArc<[Value]>> for Row
impl From<CompactArc<[Value]>> for Row
Source§fn from(values: CompactArc<[Value]>) -> Self
fn from(values: CompactArc<[Value]>) -> Self
Source§impl FromIterator<Value> for Row
impl FromIterator<Value> for Row
Source§impl<'a> IntoIterator for &'a Row
impl<'a> IntoIterator for &'a Row
Source§impl IntoIterator for Row
impl IntoIterator for Row
impl StructuralPartialEq for Row
Auto Trait Implementations§
impl Freeze for Row
impl RefUnwindSafe for Row
impl Send for Row
impl Sync for Row
impl Unpin for Row
impl UnsafeUnpin for Row
impl UnwindSafe for Row
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CompactArcDrop for T
impl<T> CompactArcDrop for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more