pub struct Computed { /* private fields */ }Expand description
One version of the store: each present table, under its TableId, as a
shared value.
The store is the run’s collection of computed tables: one writer per table,
a declared write always installs a value, and every read and write is
checked against the stage’s declarations at the access site. Computed
itself enforces the first rule (Computed::install); fold_outs
enforces the second; the third is enforced by ComputedView and
StageOut, through which every stage reads and writes. Computed
performs no access check of its own.
A Run owns the store; an embedding program reads
it after the run with Run::table or
Run::computed. Value catch-up fills a
Computed of its own, the catch-up store.
Cloning a Computed shares every table rather than copying it (one
reference count per table), so deriving the next version of the store is
cheap.
Implementations§
Source§impl Computed
impl Computed
Sourcepub fn get_erased(&self, id: TableId) -> Option<&Arc<dyn Any + Send + Sync>>
pub fn get_erased(&self, id: TableId) -> Option<&Arc<dyn Any + Send + Sync>>
Returns the type-erased table with this id, if one is present.
Sourcepub fn get_as<T: Table>(&self, id: TableId) -> Option<&T>
pub fn get_as<T: Table>(&self, id: TableId) -> Option<&T>
Returns the table with this id as a T: None when no table is
present under id, and also None when the table present is not a
T. The checked views compare the value type before they read, so
they never ask for the wrong type.
Sourcepub fn ids(&self) -> impl Iterator<Item = TableId> + '_
pub fn ids(&self) -> impl Iterator<Item = TableId> + '_
The ids of the present tables, in TableId order.
Sourcepub fn install(
&mut self,
id: TableId,
table: Arc<dyn Any + Send + Sync>,
) -> Result<(), StoreError>
pub fn install( &mut self, id: TableId, table: Arc<dyn Any + Send + Sync>, ) -> Result<(), StoreError>
Installs table under id: the table that the table’s one writer
produced, or the value of an external table installed when the run is
constructed.
This performs no check of the value type: the caller must ensure that
table is a value of the type declared for id. A typed read of a
mismatched table panics (ComputedView::get). The runner checks the
type before it installs anything.
§Errors
StoreError::SecondWriter if a table is already present under id.
A table has one writer, and plan construction guarantees it.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Computed
impl !UnwindSafe for Computed
impl Forget for Computed
impl Freeze for Computed
impl Move for Computed
impl Send for Computed
impl Sync for Computed
impl Unpin for Computed
impl UnsafeUnpin for Computed
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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