Skip to main content

sim_lib_function/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3//! Language-neutral immutable function plans.
4//!
5//! A [`FunctionPlan`] records declaration metadata only. It deliberately has
6//! no evaluation or invocation surface; later instance machinery composes a
7//! plan with a concrete guest policy.
8//!
9//! A body remains a statically selected guest policy. Type erasure cannot meet
10//! the bound of the future instance type:
11//!
12//! ```compile_fail
13//! use std::any::Any;
14//!
15//! trait GuestBodyPolicy {}
16//! struct FunctionInstance<B: GuestBodyPolicy>(B);
17//!
18//! fn erase(body: Box<dyn Any>) -> FunctionInstance<Box<dyn Any>> {
19//!     FunctionInstance(body)
20//! }
21//! ```
22
23mod bind;
24mod callable;
25mod instance;
26mod plan;
27
28pub use bind::{ArgumentInput, ArgumentOrigin, BoundArgument, BoundCall, CallInput, bind};
29pub use callable::dispatch_method_body;
30pub use instance::{
31    CapturedBinding, FunctionBodyPolicy, FunctionInstance, InstanceError, validate_capture_bindings,
32};
33pub use plan::{
34    BrowseProjection, CallMode, CaptureDescriptor, FunctionPlan, ParameterDescriptor,
35    ParameterKind, PlanError,
36};