pub struct ScopeModule<M> { /* private fields */ }Expand description
Closed, immutable module-matter artifact.
Produced by super::SubcontextBuilder::finalize; consumed
by super::ScopeKernel::spawn. The artifact carries no
live reference to its parent — it can be stored, inspected,
or moved freely.
Implementations§
Source§impl<M> ScopeModule<M>
impl<M> ScopeModule<M>
Sourcepub fn program_on(
&self,
engine: Engine,
) -> Result<Arc<dyn KernelProgram>, KernelError>
pub fn program_on( &self, engine: Engine, ) -> Result<Arc<dyn KernelProgram>, KernelError>
This module’s program on engine, compiled on the first ask
for that engine and shared by every instance after it.
This is the kernel image. A module instantiated many times —
once per coordinate, per fiber, per scenario visit — compiles
once per engine here and pays only a state per instance, which
is what Self::instantiate_under does with it.
Sourcepub fn instantiate_under(
&self,
parent: &dyn Kernel,
engine: Engine,
iter_bindings: &[(String, Value)],
) -> Result<Box<dyn Kernel>, KernelError>
pub fn instantiate_under( &self, parent: &dyn Kernel, engine: Engine, iter_bindings: &[(String, Value)], ) -> Result<Box<dyn Kernel>, KernelError>
One instance of this module under parent: a kernel on
engine over the program Self::program_on holds, with the
parent’s cells attached, its values copied in, and
iter_bindings written before either.
The image is shared; the instance is a state. Calling this a second time with different coordinates or different input values compiles nothing.
engine is the caller’s to name, and the parent’s own is the
answer a caller usually wants: a child belongs to the kernel it
was bound under, the way a for body belongs to the kernel
that opened it.
Sourcepub fn imports(&self) -> &[ImportSpec]
pub fn imports(&self) -> &[ImportSpec]
The imports the module declares.
Sourcepub fn exports(&self) -> &[ExportSpec]
pub fn exports(&self) -> &[ExportSpec]
The exports the module declares.
Sourcepub fn program(&self) -> &Arc<PolydatProgram> ⓘ
pub fn program(&self) -> &Arc<PolydatProgram> ⓘ
The body’s compiled program.
Sourcepub fn contract(&self) -> &ScopeContract<M>
pub fn contract(&self) -> &ScopeContract<M>
The contract the module was built against.
Sourcepub fn context(&self) -> &SourceContext
pub fn context(&self) -> &SourceContext
Where the module comes from.
Sourcepub fn consumers(&self) -> &[RegisteredPullConsumer]
pub fn consumers(&self) -> &[RegisteredPullConsumer]
The pull consumers registered on the module’s outputs.
Sourcepub fn diagnostics(&self) -> &[String]
pub fn diagnostics(&self) -> &[String]
Diagnostics the build recorded.
Sourcepub fn write_throughs(&self) -> &[WriteThroughBinding]
pub fn write_throughs(&self) -> &[WriteThroughBinding]
Rule 2 write-through bindings produced by the builder for
child exports that collide with a parent shared export.
Trait Implementations§
Auto Trait Implementations§
impl<M> !Freeze for ScopeModule<M>
impl<M> !RefUnwindSafe for ScopeModule<M>
impl<M> !UnwindSafe for ScopeModule<M>
impl<M> Send for ScopeModule<M>
impl<M> Sync for ScopeModule<M>
impl<M> Unpin for ScopeModule<M>
impl<M> UnsafeUnpin for ScopeModule<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