Skip to main content

ReadConstructor

Trait ReadConstructor 

Source
pub trait ReadConstructor: Send + Sync {
    // Required methods
    fn symbol(&self) -> Symbol;
    fn args_shape(&self, cx: &mut Cx) -> Result<ShapeRef>;
    fn construct_read(&self, cx: &mut Cx, args: Vec<Value>) -> Result<Value>;
}
Expand description

Contract: a read-time constructor that builds an object from read args.

The kernel defines the contract; libraries register concrete constructors that the reader invokes to build values from forms.

Required Methods§

Source

fn symbol(&self) -> Symbol

The symbol naming this constructor.

Source

fn args_shape(&self, cx: &mut Cx) -> Result<ShapeRef>

The shape the constructor’s arguments must match.

Source

fn construct_read(&self, cx: &mut Cx, args: Vec<Value>) -> Result<Value>

Constructs the value from matched arguments at read time.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§