pub struct ClosureData {
pub params: Vec<String>,
pub body: Arc<Node>,
pub captured_env: Arc<Scope>,
}Expand description
Inline payload for Value::Closure, boxed out of the enum so the
Value discriminant width is governed by the cheap variants. The
closure body (Node) plus captured scope dwarf the other variants
by tens of bytes — keeping them inline widens every Value on the
stack, every HashMap bucket holding Value, and every list slot.
Fields§
§params: Vec<String>§body: Arc<Node>P2-2: closure body shared via Arc<Node> so xs.map(f) and
Value::Closure::clone() only bump the body’s refcount instead
of deep-cloning the AST per element. The reference shape
(&closure.body) keeps existing consumers source-compatible —
Arc<Node> auto-derefs to &Node for eval_node calls.
captured_env: Arc<Scope>Trait Implementations§
Source§impl Clone for ClosureData
impl Clone for ClosureData
Source§fn clone(&self) -> ClosureData
fn clone(&self) -> ClosureData
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ClosureData
impl RefUnwindSafe for ClosureData
impl Send for ClosureData
impl Sync for ClosureData
impl Unpin for ClosureData
impl UnsafeUnpin for ClosureData
impl UnwindSafe for ClosureData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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