pub struct ScopeKernel<M> { /* private fields */ }Expand description
Typed wrapper around an Arc<PolydatKernel>.
Construction via this type goes through the SRD-67 protocol
(subcontext_builder → finalize → spawn); direct
construction from a PolydatKernel is pub(crate) for the
Phase 1 internal bridge.
Implementations§
Source§impl<M> ScopeKernel<M>
impl<M> ScopeKernel<M>
Enumerate every shared cell visible at this scope.
Delegates to PolydatKernel::shared_cells_in_scope —
the carrier lives at the kernel layer so it survives
any wrap/unwrap dance the activity layer does. The
SharedCellInScope re-export is kept for callers in
the SRD-67 builder; it’s a thin alias over the kernel
layer’s SharedCellEntry.
Sourcepub fn name(&self) -> &ChildName
pub fn name(&self) -> &ChildName
The structured name this kernel was spawned under (for child kernels) or its self-label (for root kernels).
Sourcepub fn site(&self) -> &SourceContext
pub fn site(&self) -> &SourceContext
Diagnostic site for this kernel’s construction.
Sourcepub fn lock_inner(&self) -> MutexGuard<'_, PolydatKernel>
pub fn lock_inner(&self) -> MutexGuard<'_, PolydatKernel>
Borrow the underlying PolydatKernel for read-only
operations. The lock is released when the returned guard
is dropped. Exposed for callers that drive the kernel directly
(the builder’s finalize does, as do tests).
Sourcepub fn consumers(&self) -> Vec<RegisteredPullConsumer>
pub fn consumers(&self) -> Vec<RegisteredPullConsumer>
The pull consumers registered with this kernel. Used by the activity-side fixture adapter at seal time.
Sourcepub fn has_child(&self, name: &ChildName) -> bool
pub fn has_child(&self, name: &ChildName) -> bool
Whether name is recorded in this kernel’s named-child
registry. Diagnostic; Phase 1 tests assert against this.
Sourcepub fn release_child(&self, name: &ChildName)
pub fn release_child(&self, name: &ChildName)
Drop the named child from this kernel’s registry. The child kernel itself is unaffected — only the registry entry. After release, the same name may be spawned again (typical for comprehension scopes that re-traverse per iteration). See SRD-67 §“Release semantics”.
Sourcepub fn subcontext_builder(self: Arc<Self>) -> SubcontextBuilder<M>
pub fn subcontext_builder(self: Arc<Self>) -> SubcontextBuilder<M>
Begin construction of a child sub-context. Per SRD-67
§“Step 1 — Parent yields a builder”: the builder borrows
an Arc of the parent, accumulates module matter, and
produces a closed ScopeModule artifact at finalize.
Sourcepub fn spawn(
self: &Arc<Self>,
name: ChildName,
artifact: ScopeModule<Child<M>>,
) -> Result<ScopeKernel<Child<M>>, ContractViolation>
pub fn spawn( self: &Arc<Self>, name: ChildName, artifact: ScopeModule<Child<M>>, ) -> Result<ScopeKernel<Child<M>>, ContractViolation>
Spawn a child kernel from a closed ScopeModule
artifact. Per SRD-67 §“Step 4 — Parent spawns the child
kernel”: this is the single chokepoint where every cross-
binding is resolved.
The artifact arrives with Rule 1 (name closure) and Rule 2
(the shared write-through rewrite) already applied by
SubcontextBuilder::finalize. Spawn materializes the
closed program under this parent via
PolydatKernel::materialize_subscope, whose
materialize_wiring_from_outer (kernel/state.rs) does the
live binding: attaches every parent-visible SharedCell to
a matching child slot and forwards the rest as transit
(Rule 2’s cell attach, SC8), value-copies or cell-attaches
parent outputs into child externs (Rules 4 and 5), pulls
every const output once after wiring so scope-init values
see post-bind inputs (Rule 3), and freezes the scope
coordinates. Per-cycle publication to the cells is
Self::commit_write_throughs.
Sourcepub fn write_throughs(&self) -> &[WriteThroughBinding]
pub fn write_throughs(&self) -> &[WriteThroughBinding]
The Rule 2 write-through bindings carried by this kernel.
Empty for the vast majority of kernels; populated only
when the artifact’s finalize rewrote a child export to
a parent shared cell write.
Sourcepub fn commit_write_throughs(&self) -> Result<(), String>
pub fn commit_write_throughs(&self) -> Result<(), String>
Per-cycle Rule 2 commit: pulls every write-through’s
synthetic source output (__write_<X>) and stores its
value through the corresponding child input slot for
<X>. Because materialize_wiring_from_outer attached the parent’s
SharedCell to that slot, the write propagates to the
cell, where it becomes visible to the parent and to any
sibling that shares the same cell.
No-op for kernels with no write-throughs.
TYPE-STABLE (scope_model.md §“Type stability”): each pending
value passes the same boundary as
crate::kernel::PolydatKernel::commit_write_throughs —
matching types pass, catalog adapters heal (widening), and an
unhealable mismatch is an Err at the write site.
Trait Implementations§
Auto Trait Implementations§
impl<M> !Freeze for ScopeKernel<M>
impl<M> RefUnwindSafe for ScopeKernel<M>
impl<M> Send for ScopeKernel<M>
impl<M> Sync for ScopeKernel<M>
impl<M> Unpin for ScopeKernel<M>
impl<M> UnsafeUnpin for ScopeKernel<M>
impl<M> UnwindSafe for ScopeKernel<M>
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> 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> ⓘ
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