Skip to main content

Module handle

Module handle 

Source
Expand description

Handles of Lean values: Lean<L> keeps a value as the Lean object, without converting it to a Rust value.

The type argument L names the Lean type by the Rust type of the public functions (u64, String, Option<T>, Result<T, E>, (A, B), generated structs and enums); a Lean List α is List<T> and an Array α is Array<T>, since both are Vec<T> in Rust. LeanRepr::Value is the Rust value of L.

The object of a handle is shared between threads: creating the handle marks every object reachable from it with lean_mark_mt, so that its reference counts are updated atomically. Lean functions that receive such an object build new objects instead of updating it in place.

Local<L> is the handle that stays on the thread that made it: its objects keep the reference counts of one thread, so a Lean function that receives the only reference to an object updates it in place.

Structs§

Array
The Lean type Array α; its Rust value is Vec<T::Value>.
Fin
The Lean type Fin N; its Rust value is usize.
Lean
A Lean value of the type named by L, kept as the Lean object.
List
The Lean type List α; its Rust value is Vec<T::Value>.
Local
A Lean value of the type named by L, kept as the Lean object on the thread that made it.

Traits§

IntoLean
An argument of a function of the lean or local module of a generated module: the Rust value of L (converted for the call), a &Lean<L>, a Lean<L>, a &Local<L> or a Local<L>.
LeanRepr
A Rust type that names a Lean type whose values a Lean handle can hold.