Struct ketos::bytecode::Code
[−]
[src]
pub struct Code { pub name: Option<Name>, pub consts: Box<[Value]>, pub code: Box<[u8]>, pub kw_params: Box<[Name]>, pub n_params: u32, pub req_params: u32, pub flags: u32, pub doc: Option<String>, }
Represents a compiled bytecode function or expression.
Fields
name: Option<Name>
Code object name, if present; top-level expressions and lambda code values do not have a name.
consts: Box<[Value]>
Const values referenced in bytecode
code: Box<[u8]>
Function body bytecode
kw_params: Box<[Name]>
Names of keyword parameters accepted in the order in which they are expected.
n_params: u32
Number of positional parameters accepted; this includes optional
parameters, but excludes keyword and rest parameters, if accepted.
Optional parameter values may be Unbound
.
req_params: u32
Number of positional parameters which must not be Unbound
.
flags: u32
Miscellaneous flags; see code_flags
for bit flag values.
doc: Option<String>
Optional documentation string
Methods
impl Code
[src]
fn arity(&self) -> Arity
Returns the computed arity of the compiled function.
fn has_rest_params(&self) -> bool
Returns whether the function accepts a rest parameter.
fn has_kw_params(&self) -> bool
Returns whether the function accepts one or more keyword parameters.
fn is_trivial(&self) -> bool
Returns whether all bytecode instructions can be executed without side effects.
Such a code object typically results from compilation of compile-time operators.
Trait Implementations
impl Clone for Code
[src]
fn clone(&self) -> Code
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more