Struct spacetimedb_vm::expr::SourceSet
source · pub struct SourceSet<T, const N: usize>(/* private fields */);Expand description
A SourceProvider backed by an ArrayVec.
Internally, the SourceSet stores an Option<T> for each planned SourceId
which are Option::taken out of the set.
Implementations§
source§impl<T, const N: usize> SourceSet<T, N>
impl<T, const N: usize> SourceSet<T, N>
sourcepub fn add(&mut self, table: T) -> SourceId
pub fn add(&mut self, table: T) -> SourceId
Insert an entry into this SourceSet so it can be used in a query plan,
and return a SourceId which can be embedded in that plan.
sourcepub fn take(&mut self, id: SourceId) -> Option<T>
pub fn take(&mut self, id: SourceId) -> Option<T>
Extract the entry referred to by id from this SourceSet,
leaving a “gap” in its place.
Subsequent calls to take on the same id will return None.
source§impl<const N: usize> SourceSet<Vec<ProductValue>, N>
impl<const N: usize> SourceSet<Vec<ProductValue>, N>
sourcepub fn add_mem_table(&mut self, table: MemTable) -> SourceExpr
pub fn add_mem_table(&mut self, table: MemTable) -> SourceExpr
Insert a MemTable into this SourceSet so it can be used in a query plan,
and return a SourceExpr which can be embedded in that plan.
sourcepub fn take_table(&mut self, source: &SourceExpr) -> Option<Table>
pub fn take_table(&mut self, source: &SourceExpr) -> Option<Table>
Resolve source to a Table for use in query execution.
If the source is a SourceExpr::DbTable, this simply clones the DbTable and returns it.
(DbTable::clone is inexpensive.)
In this case, self is not modified.
If the source is a [SourceExpr::MemTable], this behaves like [Self::take_mem_table].
Subsequent calls to take_table or take_mem_table with the same source will fail.
Trait Implementations§
source§impl<T: PartialEq, const N: usize> PartialEq for SourceSet<T, N>
impl<T: PartialEq, const N: usize> PartialEq for SourceSet<T, N>
source§impl<'a, T: 'a + IntoIterator<Item = RelValue<'a>>, const N: usize> SourceProvider<'a> for SourceSet<T, N>
impl<'a, T: 'a + IntoIterator<Item = RelValue<'a>>, const N: usize> SourceProvider<'a> for SourceSet<T, N>
impl<T: Eq, const N: usize> Eq for SourceSet<T, N>
impl<T, const N: usize> StructuralPartialEq for SourceSet<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for SourceSet<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for SourceSet<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for SourceSet<T, N>where
T: Send,
impl<T, const N: usize> Sync for SourceSet<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for SourceSet<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for SourceSet<T, N>where
T: UnwindSafe,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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