Skip to main content

ScopeKernel

Struct ScopeKernel 

Source
pub struct ScopeKernel { /* private fields */ }
Expand description

A scope kernel and the interpreter program it stands for.

Implementations§

Source§

impl ScopeKernel

Source

pub fn root( interpreter: PolydatKernel, image: Option<Arc<dyn KernelProgram>>, ) -> Self

A root scope compiled from source: interpreter is the compiled kernel, and image the fiber engine’s program for the same source and options, when it can stand in for interpreter’s program (crate::fiber_engine::source_image).

Source

pub fn compile(source: &str) -> Result<Self, String>

A root scope compiled from source with default options (crate::bindings::compile_scope_kernel).

Source

pub fn build_under( parent: &dyn Kernel, matter: SourceMatter, ) -> Result<Self, String>

A child scope built from source matter under parent — the any-engine form of build_subscope (native_scope_trees.md §5): the matter finalizes to a module, which is instantiated under parent. Strict mode refuses a const that silently fell through to an outer value, as build_subscope does.

Source

pub fn synthesize_under( parent: &ScopeKernel, matter: SourceMatter, ) -> Result<Self, String>

Self::build_under a parent scope, then write each of the parent’s input values into the child’s input of the same name — how every synthesized scope (phase, for_each, do-loop, op template) is built. A value the child’s input refuses is an error.

Source

pub fn bind_under( &self, parent: &dyn Kernel, bindings: &[(String, Value)], ) -> Result<Self, String>

Another instance of this scope’s program under parent, with bindings written into its inputs first — the any-engine form of for_iteration(canonical, parent, bindings), and of build_subscope with program matter.

Source

pub fn fork(&self) -> Self

A copy of this scope with its state — inputs, outputs, cells shared (native_scope_trees.md §4): a fiber’s starting kernel, an activation scope, a probe that leaves this one undisturbed.

Source

pub fn program(&self) -> &Arc<PolydatProgram> ⓘ

The interpreter program this scope stands for: what synthesis and checkpoint identity read.

Source

pub fn image(&self) -> &Arc<dyn KernelProgram> ⓘ

The program the running kernel is on.

Source

pub fn module(&self) -> Option<&Arc<OpTemplateModule>>

The module a source-built scope finalized to, from which each fiber instantiates its own kernel with the module’s write-throughs.

Source

pub fn kernel(&self) -> &dyn Kernel

The running kernel.

Source

pub fn into_kernel(self) -> Box<dyn Kernel>

The running kernel, for a holder of a bare dyn Kernel — an adapter’s canonical kernel. Its program_id is this scope’s.

Source

pub fn kernel_mut(&mut self) -> &mut dyn Kernel

The running kernel, mutably.

Source

pub fn lookup(&self, name: &str) -> Option<Value>

A name’s value in this scope without evaluating anything: a const’s value, an input, a value the build folded. A computed output is not a scope value, before or after a pull, on any engine; Self::pull_value evaluates one.

Source

pub fn pull_value(&self, name: &str) -> Option<Value>

A name’s value, evaluating a computed output on a fork so this scope’s state is undisturbed: Self::lookup first, then a pull.

Source

pub fn scope_values(&self) -> Vec<(String, Value)>

The values this scope’s inputs hold, by name, for writing into other kernels: every input with a value except a const’s slot, which only initialization writes (each kernel the values go into initializes its own consts from them).

Trait Implementations§

Source§

impl Debug for ScopeKernel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for ScopeKernel

Source§

type Target = dyn Kernel

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for ScopeKernel

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl From<PolydatKernel> for ScopeKernel

Source§

fn from(kernel: PolydatKernel) -> Self

An interpreter kernel as a scope: a kernel standing outside the tree’s construction (a test fixture, a probe) that a scope is bound under.

Source§

impl IntoSharedScope for ScopeKernel

Source§

fn into_shared_scope(self) -> Arc<ScopeKernel> ⓘ

The scope, shared.
Source§

impl Lookup for ScopeKernel

Source§

fn lookup(&self, name: &str) -> Option<Value>

The value name denotes here, if any.
Source§

fn ledger(&self) -> &Arc<CompileLedger> ⓘ

The compile ledger of the program tree this scope belongs to: what a source or predicate that has to compile is charged to.
Source§

impl ProgramKernel for ScopeKernel

Source§

fn split_program(&mut self) -> (&mut dyn Kernel, Arc<PolydatProgram>)

The running kernel and its program.
Source§

impl WireSource for ScopeKernel

WireSource over &ScopeKernel — covers names that the kernel’s lookup API already exposes (inputs, scope-init constants, shared-cell-backed values). Computed outputs that require a memoizing pull(&mut state, …) evaluation are NOT covered here and return None from get; the SRD-68 Push 2 work introduces a richer WireSource impl that owns the per-fiber kernel handle with interior mutability and can pull outputs at cycle time.

For Push 1 this &ScopeKernel impl is the additive baseline: every existing call site that gets handed a NullWireSource continues working unchanged, and code that wants kernel-side reads via the trait can use it for the names lookup already answers.

Source§

fn get(&self, name: &str) -> Option<Value>

Look up name in this kernel’s scope. Returns the current value (cloned, owned) or None when the name is not declared here. Callers do not retry against another kernel — a None is the resolution result, full stop.
Source§

fn names(&self) -> Box<dyn Iterator<Item = String> + '_>

Iterate declared names. Order is implementation-defined. Used by validators and diagnostic renderers.
Source§

fn write(&self, _name: &str, _value: Value) -> WriteOutcome

Write value into the named input slot of this kernel. Returns WriteOutcome::Stored when the slot exists and the value was written, WriteOutcome::NoSlot when the kernel’s program has no input slot named name. Read more
Source§

fn reset(&self, _name: &str) -> WriteOutcome

Reset the named input slot to its DECLARED initial value — the author’s identity element for that wire. The capture layer uses this for min/max-of-nothing (SRD-93-era fold totality): an empty measurement restores the wire to its declared unit rather than parking Value::None on a typed slot, where every downstream consumer would have to be None-aware. Default impl returns NoSlot (read-only sources have nothing to reset).
Source§

fn advance(&self, _coord: u64)

Advance the underlying kernel state to coordinate coord and invalidate any memoized pulls so subsequent get calls produce values for this coord. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for ScopeKernel

§

impl !UnwindSafe for ScopeKernel

§

impl Forget for ScopeKernel

§

impl Freeze for ScopeKernel
where *const dyn Kernel is !null: Freeze, PhantomData<dyn Kernel>: Freeze, *const ArcInner<PolydatProgram> is !null: Freeze, PhantomData<ArcInner<PolydatProgram>>: Freeze, *const ArcInner<dyn KernelProgram> is !null: Freeze, PhantomData<ArcInner<dyn KernelProgram>>: Freeze, *const ArcInner<ScopeModule<Child<RootMarker>>> is !null: Freeze, PhantomData<ArcInner<ScopeModule<Child<RootMarker>>>>: Freeze,

§

impl Move for ScopeKernel

§

impl Send for ScopeKernel

§

impl Sync for ScopeKernel

§

impl Unpin for ScopeKernel

§

impl UnsafeUnpin for ScopeKernel

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more