Skip to main content

Module builder

Module builder 

Source
Expand description

High-level helper to define a Cranelift function: declares the function, creates the FunctionBuilderContext + entry block, runs the user-supplied body closure to populate the IR, emits the return, and finalizes.

The body closure receives &mut FunctionBuilder, &mut Module, and the entry-block parameters. It returns the values to be returned, via the IntoReturns trait — so (), a single Value, [Value; N], or Vec<Value> all work without ceremony.

Traits§

IntoReturns
Conversion from common Rust shapes to a return-Value list.

Functions§

define_function
Declare and define a Cranelift function in one call.