pub struct Lambda {
pub(crate) chunk: Chunk,
pub(crate) name: Option<SmolStr>,
pub(crate) upvalue_count: usize,
pub(crate) formals: Option<Formals>,
pub(crate) param_name: String,
}Expand description
The opcodes for a thunk or closure, plus the number of
non-executable opcodes which are allowed after an OpThunkClosure or
OpThunkSuspended referencing it. At runtime Lambda is usually wrapped
in Rc to avoid copying the Chunk it holds (which can be
quite large).
In order to correctly reproduce cppnix’s “pointer equality”
semantics it is important that we never clone a Lambda –
use Rc<Lambda>::clone() instead. This struct deliberately
does not derive(Clone) in order to prevent this from being
done accidentally.
Fields§
§chunk: Chunk§name: Option<SmolStr>Name of the function (equivalent to the name of the identifier (e.g. a value in a let-expression or an attribute set entry) it is located in).
upvalue_count: usizeNumber of upvalues which the code in this Lambda closes over, and which need to be initialised at runtime.
formals: Option<Formals>§param_name: StringParameter name for simple functions (e.g., name: ...).
Used by builtins.toXML to generate proper parameter names.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lambda
impl !RefUnwindSafe for Lambda
impl !Send for Lambda
impl !Sync for Lambda
impl Unpin for Lambda
impl !UnwindSafe for Lambda
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more