pub struct FunctionFlags(/* private fields */);Expand description
Flags used to define the properties of a Function
Implementations§
Source§impl FunctionFlags
impl FunctionFlags
Sourcepub fn new(
variadic: bool,
generator: bool,
arg_is_unpacked_tuple: bool,
non_local_access: bool,
) -> Self
pub fn new( variadic: bool, generator: bool, arg_is_unpacked_tuple: bool, non_local_access: bool, ) -> Self
Returns a new FunctionFlags with the given flags set
Sourcepub fn is_variadic(self) -> bool
pub fn is_variadic(self) -> bool
True if the function has a variadic argument
If the function is variadic, then extra args will be captured in a tuple.
Sourcepub fn is_generator(self) -> bool
pub fn is_generator(self) -> bool
True if the function is a generator
If the function is a generator, then calling the function will yield an iterator that executes the function’s body for each iteration step, pausing when a yield instruction is encountered.
Sourcepub fn arg_is_unpacked_tuple(self) -> bool
pub fn arg_is_unpacked_tuple(self) -> bool
True if the function has a single argument which is an unpacked tuple
This is used to optimize calls where the caller has a series of args that might be unpacked by the function, and it would be wasteful to create a Tuple when it’s going to be immediately unpacked and discarded.
Sourcepub fn non_local_access(self) -> bool
pub fn non_local_access(self) -> bool
True if the function accesses a non-local value
Functions that access a non-local value need to carry module exports and wildcard imports with them, if no non-locals are accessed then the creation of the non-local context can be skipped.
Trait Implementations§
Source§impl Clone for FunctionFlags
impl Clone for FunctionFlags
Source§fn clone(&self) -> FunctionFlags
fn clone(&self) -> FunctionFlags
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more