Skip to main content

Module codec

Module codec 

Source
Expand description

Conversions between Rust values and Lean objects, chosen by the Lean type.

Several Lean types share one Rust type: Array α and List α are both Vec<T>, and ByteArray and Array UInt8 are both Vec<u8>. A conversion therefore cannot be found from the Rust type alone. Generated code names it instead, as a type that implements Codec and mirrors the Lean type: Array<List<Plain<Nat>>> converts a Vec<Vec<Nat>> to and from a Lean Array (List Nat).

Structs§

Array
Lean’s Array α as a Vec.
Boxed
A value that the Rust type keeps in a Box, as recursive types must.
ByteArray
Lean’s ByteArray as a Vec<u8>.
Except
Lean’s Except ε α as a Result. Lean names the error type first, Rust the value type.
FloatArray
Lean’s FloatArray as a Vec<f64>.
List
Lean’s List α as a Vec.
Option
Lean’s Option α.
Pair
Lean’s α × β as a pair.
Plain
A type whose Lean counterpart follows from the Rust type: the scalars, Nat, Int, String.

Traits§

Codec
A conversion between a Rust type and the Lean type the implementor stands for.