pub trait Factory: Send + Sync {
// Required methods
fn opaque(&self, value: Arc<dyn RuntimeObject>) -> Result<Value>;
fn class_stub(&self, id: ClassId, symbol: Symbol) -> Result<Value>;
fn nil(&self) -> Result<Value>;
fn bool(&self, value: bool) -> Result<Value>;
fn symbol(&self, value: Symbol) -> Result<Value>;
fn string(&self, value: String) -> Result<Value>;
fn bytes(&self, value: Vec<u8>) -> Result<Value>;
fn list(&self, items: Vec<Value>) -> Result<Value>;
fn table(&self, entries: Vec<(Symbol, Value)>) -> Result<Value>;
fn expr(&self, expr: Expr) -> Result<Value>;
fn number_literal(&self, domain: Symbol, canonical: String) -> Result<Value>;
// Provided method
fn table_one(&self, key: Symbol, value: Value) -> Result<Value> { ... }
}Expand description
Constructs runtime Values from kernel data.
The kernel defines this contract and threads a &dyn Factory through every
Cx; libraries supply the concrete object representations the
factory hands back. DefaultFactory provides a minimal built-in
implementation for scalars and core collections.
Required Methods§
Sourcefn opaque(&self, value: Arc<dyn RuntimeObject>) -> Result<Value>
fn opaque(&self, value: Arc<dyn RuntimeObject>) -> Result<Value>
Wraps an arbitrary runtime object as an opaque value.
Sourcefn class_stub(&self, id: ClassId, symbol: Symbol) -> Result<Value>
fn class_stub(&self, id: ClassId, symbol: Symbol) -> Result<Value>
Builds a class value from a class id and symbol.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".