Expand description
Runtime of the Rust code generated from Lean IR by leanfran: the object model of lean.h
and the lean_* functions of the C runtime, under their C names.
§Safety
Every function follows the calling convention of its C counterpart: object arguments are
consumed unless the C declaration borrows them (b_lean_obj_arg, @& in Lean), results
are owned unless documented as borrowed, and every Obj must be a valid Lean value of the
type the function expects. Objects use single-threaded reference counts and must stay on
the thread that created them.
Re-exports§
pub use array::*;pub use closure::*;pub use float::*;pub use fs::*;pub use int::*;pub use io::*;pub use io_error::*;pub use marshal::*;pub use model::*;pub use nat::*;pub use object::*;pub use panic::*;pub use process::*;pub use string::*;pub use thunk::*;pub use uint::*;
Modules§
- array
Array(arrays of objects) and scalar arrays (ByteArray,FloatArray).- closure
- Closures and their application (
lean_apply_*, ported fromapply.cpp). - float
Float(f64) andFloat32(f32). The transcendental functions keep the bare C names ofmath.hand are computed by thelibmcrate;sqrtuses the exactf64::sqrt.- fs
- Files, directories and the environment of the process:
IO.FS,IO.getEnv,IO.appPath, the current directory, process and thread ids, random bytes andtimeit. - int
Int: scalars in the range ofi32on 64-bit machines and of 31-bit integers on 32-bit machines (as inlean.h),num-bigintvalues in mpz objects outside it.- io
- IO primitives: results (
EST.Out), handles (the standard streams and files), streams,ST.Refand the monotonic clocks. - io_
error IO.Error: its constructors, the translation of OS error codes (lean_decode_io_error, after libuv’s classification and messages, as the C runtime does), andIO.Error.toString.- marshal
- Conversions between Rust values and Lean objects, used by the generated public functions.
- model
- Rust values in the representation of Aeneas’s Lean model of Rust.
- nat
Nat: scalars up toLEAN_MAX_SMALL_NAT,num-bigintvalues in mpz objects above.- object
- Object model of
lean.h: object layouts, allocation, reference counting, boxing and constructor objects. - panic
- Panics (
lean_panic_fn, internal panics) anddbgTrace, with the messages of the C runtime. - process
- Child processes (
IO.Process.spawnandIO.Process.Child), withforkandexecvpas in the C runtime: a command that cannot be executed is reported by the child on its standard error, and the child exits with 255. - string
String: UTF-8 bytes with a'\0'terminator,m_sizebytes including it,m_lengthcode points.String.Posis a byte offset.- thunk
Thunk(evaluated on firstget) andTask(run synchronously when created; there are no worker threads).- uint
- Fixed-width integers:
UInt8..UInt64,USizeand the signedInt8..Int64,ISize(stored in the unsigned type of the same width, as in the IR).
Constants§
- EXTERNS
- C names of the functions this runtime provides (generated by
build.rs).
Functions§
- lean_
internal_ ⚠get_ hardware_ concurrency System.Platform.Internal.getHardwareConcurrency: the number of hardware threads, or 0.- lean_
ptr_ ⚠addr_ unsafe ptrAddrUnsafe.- lean_
system_ ⚠platform_ emscripten System.Platform.getIsEmscripten.- lean_
system_ ⚠platform_ linux System.Platform.getIsLinux.- lean_
system_ ⚠platform_ nbits System.Platform.getNumBits: the word size of the target.- lean_
system_ ⚠platform_ osx System.Platform.getIsOSX.- lean_
system_ ⚠platform_ target System.Platform.getTarget: the target triple the runtime was compiled for.- lean_
system_ ⚠platform_ windows System.Platform.getIsWindows.