Skip to main content

Crate leanfran_runtime

Crate leanfran_runtime 

Source
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 handle::*;
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 from apply.cpp).
float
Float (f64) and Float32 (f32). The transcendental functions keep the bare C names of math.h and are computed by the libm crate; sqrt uses the exact f64::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 and timeit.
handle
Handles of Lean values: Lean<L> keeps a value as the Lean object, without converting it to a Rust value.
int
Int: scalars in the range of i32 on 64-bit machines and of 31-bit integers on 32-bit machines (as in lean.h), num-bigint values in mpz objects outside it.
io
IO primitives: results (EST.Out), handles (the standard streams and files), streams, ST.Ref and 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), and IO.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 to LEAN_MAX_SMALL_NAT, num-bigint values 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) and dbgTrace, with the messages of the C runtime.
process
Child processes (IO.Process.spawn and IO.Process.Child), with fork and execvp as 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_size bytes including it, m_length code points. String.Pos is a byte offset.
thunk
Thunk (evaluated on first get) and Task (run synchronously when created; there are no worker threads).
uint
Fixed-width integers: UInt8..UInt64, USize and the signed Int8..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.