pub struct Row { /* private fields */ }Expand description
Row layout: a positional vector indexed by VarId.0. Two reasons this beats
the previous BTreeMap<VarId, RowEntry>:
- Cheaper clone. Per-row clone is on the hottest path of the executor
(every filter, projection, expand, optional-match). A
BTreeMapclone allocates one tree node per entry; aSmallVecclone is a singlememcpy(or zero allocations when the row fits inline). - O(1) lookup.
VarIds are denseu32s minted from 0 by the analyzer’sSymbolTable(lora-analyzer/src/symbols.rs:23), so the positional index is exact and tight.
entries[i] == None means “VarId(i) is unset”; the cached len_set
counter keeps len() O(1) without scanning. The inline capacity (8)
covers typical query rows without touching the heap.
Implementations§
Source§impl Row
impl Row
pub fn new() -> Row
pub fn get(&self, key: VarId) -> Option<&LoraValue>
Sourcepub fn get_name(&self, key: VarId) -> Option<String>
pub fn get_name(&self, key: VarId) -> Option<String>
Returns the column name for key, generating the _{key} fallback
on demand for entries inserted without an explicit name.
pub fn insert(&mut self, key: VarId, value: LoraValue)
pub fn insert_named( &mut self, key: VarId, name: impl Into<String>, value: LoraValue, )
pub fn extend_from(&mut self, other: &Row)
pub fn iter(&self) -> impl Iterator<Item = (&VarId, &LoraValue)>
Sourcepub fn iter_named(
&self,
) -> impl Iterator<Item = (&VarId, Cow<'_, str>, &LoraValue)>
pub fn iter_named( &self, ) -> impl Iterator<Item = (&VarId, Cow<'_, str>, &LoraValue)>
Iterate (key, name, value). The name is a Cow: borrowed when an
explicit name was stored, and owned (lazily formatted as _{key}) for
entries inserted via the anonymous insert() path.
Sourcepub fn into_iter_named(self) -> impl Iterator<Item = (VarId, String, LoraValue)>
pub fn into_iter_named(self) -> impl Iterator<Item = (VarId, String, LoraValue)>
Consume the row and yield owned (VarId, name, LoraValue) triples.
Used by hydrate_row to avoid cloning values on the projection hot path.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn contains_key(&self, key: VarId) -> bool
Trait Implementations§
Source§impl Serialize for Row
impl Serialize for Row
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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