Skip to main content

LinkRegistry

Trait LinkRegistry 

Source
pub trait LinkRegistry {
    // Required methods
    fn resolve_primitive(&self, symbol: &str) -> Option<KernelRef>;
    fn resolve_fused(&self, symbol: &str) -> Option<KernelRef>;

    // Provided method
    fn resolve_cost_fn(&self, _name: &str) -> Option<CostFn> { ... }
}
Expand description

Resolve a contract’s entry_point symbol string into a concrete KernelRef function pointer. Each provider crate implements this over its exported &'static [(&str, KernelRef)] table (FKC §12.6); a test stub maps every symbol to a dummy kernel.

The importer never fabricates a function pointer — it looks the symbol up and errors (FkcError::UnknownEntryPoint) if absent. This keeps P9 (serializable contracts, no pointers in the file) honest.

Required Methods§

Source

fn resolve_primitive(&self, symbol: &str) -> Option<KernelRef>

Resolve a primitive (op_kind) kernel’s entry point.

Source

fn resolve_fused(&self, symbol: &str) -> Option<KernelRef>

Resolve a fused (fused_op) kernel’s entry point.

Provided Methods§

Source

fn resolve_cost_fn(&self, _name: &str) -> Option<CostFn>

Resolve a contract’s cost.cost_fn NAME into a concrete CostFn pointer — the cost-model analogue of Self::resolve_primitive (§4.4 cost-fn trampoline, Task-F). A provider that pins real cost fns exports its own &'static [(&str, CostFn)] table and overrides this over it (exactly as it exports its entry_point table); the built-in default is None (no cost-fn table), so every existing LinkRegistry impl and test stub compiles unchanged and a section that names no cost fn is unaffected. The importer never fabricates a pointer: an unresolved name is a typed FkcError::UnknownCostFn, never a silent unknown_cost fallback (P9 — the resolved cost model is a real registered fn, not a serialized pointer).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§