Struct spacetimedb_table::table::RowRef
source · pub struct RowRef<'a> { /* private fields */ }
Expand description
A reference to a single row within a table.
§Safety
Having a r: RowRef
is a proof that r.pointer()
refers to a valid row.
This makes constructing a RowRef
, i.e., RowRef::new
, an unsafe
operation.
Implementations§
source§impl<'a> RowRef<'a>
impl<'a> RowRef<'a>
sourcepub fn to_product_value(&self) -> ProductValue
pub fn to_product_value(&self) -> ProductValue
Extract a ProductValue
from the table.
This is a potentially expensive operation,
as it must walk the table’s ProductTypeLayout
and heap-allocate various substructures of the ProductValue
.
sourcepub fn project_not_empty(
self,
cols: &ColList
) -> Result<AlgebraicValue, InvalidFieldError>
pub fn project_not_empty( self, cols: &ColList ) -> Result<AlgebraicValue, InvalidFieldError>
Construct a projection of the row at self
by extracting the cols
.
Returns an error if cols
specifies an index which is out-of-bounds for the row at self
.
If cols
contains more than one column, the values of the projected columns are wrapped in a ProductValue
.
If cols
is a single column, the value of that column is returned without wrapping in a ProductValue
.
sourcepub fn pointer(&self) -> RowPointer
pub fn pointer(&self) -> RowPointer
Returns the raw row pointer for this row reference.
Trait Implementations§
impl<'a> Copy for RowRef<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for RowRef<'a>
impl<'a> !Send for RowRef<'a>
impl<'a> !Sync for RowRef<'a>
impl<'a> Unpin for RowRef<'a>
impl<'a> !UnwindSafe for RowRef<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Satn for T
impl<T> Satn for T
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
f
.source§fn fmt_psql(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt_psql(&self, f: &mut Formatter<'_>) -> Result<(), Error>
f
.source§fn to_satn(&self) -> String
fn to_satn(&self) -> String
String
.source§fn to_satn_pretty(&self) -> String
fn to_satn_pretty(&self) -> String
String
.