pub struct BeamFunction {
pub name: String,
pub arity: usize,
pub clauses: Vec<BeamClause>,
pub params: Vec<String>,
pub annotations: Vec<(String, String)>,
pub exported: bool,
pub instrs: Vec<BeamInstr>,
pub frame_size: u32,
pub return_type: Option<BeamType>,
pub param_types: Vec<BeamType>,
}Expand description
A function in a BEAM module.
Fields§
§name: StringFunction name (atom)
arity: usizeNumber of formal parameters
clauses: Vec<BeamClause>Core Erlang style clauses (pattern, guard, body)
params: Vec<String>Optional parameter names (for documentation)
annotations: Vec<(String, String)>Key-value annotations (e.g., {file, "foo.erl"})
exported: boolWhether this function is exported
instrs: Vec<BeamInstr>Low-level instruction sequence (populated by lowering pass)
frame_size: u32Number of Y-register (stack) slots needed
return_type: Option<BeamType>Return type annotation
param_types: Vec<BeamType>Parameter type annotations
Implementations§
Source§impl BeamFunction
impl BeamFunction
Sourcepub fn new(name: impl Into<String>, arity: usize) -> Self
pub fn new(name: impl Into<String>, arity: usize) -> Self
Create a new function with the given name and arity.
Sourcepub fn add_clause(&mut self, clause: BeamClause)
pub fn add_clause(&mut self, clause: BeamClause)
Add a clause to this function.
Trait Implementations§
Source§impl Clone for BeamFunction
impl Clone for BeamFunction
Source§fn clone(&self) -> BeamFunction
fn clone(&self) -> BeamFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BeamFunction
impl RefUnwindSafe for BeamFunction
impl Send for BeamFunction
impl Sync for BeamFunction
impl Unpin for BeamFunction
impl UnsafeUnpin for BeamFunction
impl UnwindSafe for BeamFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more