pub struct FunctionInstance<B: FunctionBodyPolicy> { /* private fields */ }Expand description
A language-neutral, managed function object with a concrete guest body.
Each capture is represented twice for distinct purposes: its existing
BindingCell supplies shared lexical mutation, while its ManagedHandle
becomes a strong edge in the common managed graph. No private environment
graph or body registry is involved.
Implementations§
Source§impl<B: FunctionBodyPolicy> FunctionInstance<B>
impl<B: FunctionBodyPolicy> FunctionInstance<B>
Sourcepub fn new(
plan: FunctionPlan,
body: B,
captures: Vec<CapturedBinding>,
class: ClassRef,
args_shape: Option<ShapeRef>,
result_shape: Option<ShapeRef>,
) -> Result<Self, InstanceError>
pub fn new( plan: FunctionPlan, body: B, captures: Vec<CapturedBinding>, class: ClassRef, args_shape: Option<ShapeRef>, result_shape: Option<ShapeRef>, ) -> Result<Self, InstanceError>
Builds an instance from a plan, typed body, managed captures, and runtime metadata.
Sourcepub const fn plan(&self) -> &FunctionPlan
pub const fn plan(&self) -> &FunctionPlan
Borrows the immutable declaration plan.
Sourcepub const fn body(&self) -> &B
pub const fn body(&self) -> &B
Borrows the concrete guest body policy without erasure or downcasting.
Sourcepub fn captures(&self) -> &[CapturedBinding]
pub fn captures(&self) -> &[CapturedBinding]
Borrows the capture cells in plan declaration order.
Sourcepub const fn supplied_class(&self) -> &ClassRef
pub const fn supplied_class(&self) -> &ClassRef
Borrows the caller-supplied runtime class.
Sourcepub const fn args_shape(&self) -> Option<&ShapeRef>
pub const fn args_shape(&self) -> Option<&ShapeRef>
Borrows the caller-supplied argument Shape, when present.
Sourcepub const fn result_shape(&self) -> Option<&ShapeRef>
pub const fn result_shape(&self) -> Option<&ShapeRef>
Borrows the caller-supplied result Shape, when present.
Sourcepub fn invoke_bound(&self, cx: &mut Cx, call: BoundCall) -> KernelResult<Value>
pub fn invoke_bound(&self, cx: &mut Cx, call: BoundCall) -> KernelResult<Value>
Invokes the guest policy through the neutral evaluated-value boundary.
Kernel calls and optional dispatch-method adaptation both use this path,
so neither surface can change the policy-visible BoundCall.
Trait Implementations§
Source§impl<B: FunctionBodyPolicy> Callable for FunctionInstance<B>
impl<B: FunctionBodyPolicy> Callable for FunctionInstance<B>
Source§fn call(&self, cx: &mut Cx, args: Args) -> KernelResult<Value>
fn call(&self, cx: &mut Cx, args: Args) -> KernelResult<Value>
Args.Source§fn browse_args_shape(&self, _cx: &mut Cx) -> KernelResult<Option<ShapeRef>>
fn browse_args_shape(&self, _cx: &mut Cx) -> KernelResult<Option<ShapeRef>>
Source§fn browse_result_shape(&self, _cx: &mut Cx) -> KernelResult<Option<ShapeRef>>
fn browse_result_shape(&self, _cx: &mut Cx) -> KernelResult<Option<ShapeRef>>
Source§impl<B: Clone + FunctionBodyPolicy> Clone for FunctionInstance<B>
impl<B: Clone + FunctionBodyPolicy> Clone for FunctionInstance<B>
Source§fn clone(&self) -> FunctionInstance<B>
fn clone(&self) -> FunctionInstance<B>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<B: FunctionBodyPolicy> ManagedObject for FunctionInstance<B>
impl<B: FunctionBodyPolicy> ManagedObject for FunctionInstance<B>
Source§fn trace_edges(&self, visitor: &mut dyn EdgeVisitor)
fn trace_edges(&self, visitor: &mut dyn EdgeVisitor)
Source§impl<B: FunctionBodyPolicy> Object for FunctionInstance<B>
impl<B: FunctionBodyPolicy> Object for FunctionInstance<B>
Source§fn display(&self, _cx: &mut Cx) -> KernelResult<String>
fn display(&self, _cx: &mut Cx) -> KernelResult<String>
Source§fn header(&self) -> &ObjectHeader
fn header(&self) -> &ObjectHeader
Source§fn op(&self, _key: &OpKey) -> Option<&dyn Op>
fn op(&self, _key: &OpKey) -> Option<&dyn Op>
key, if any.