pub struct Upvalues {
static_upvalues: Vec<Value>,
with_stack: Option<Vec<Value>>,
}
Expand description
Structure for carrying upvalues of an UpvalueCarrier. The implementation of this struct encapsulates the logic for capturing and accessing upvalues.
Nix’s with
cannot be used to shadow an enclosing binding –
like Rust’s use xyz::*
construct, but unlike Javascript’s
with (xyz)
. This means that Nix has two kinds of identifiers,
which can be distinguished at compile time:
- Static identifiers, which are bound in some enclosing scope by
let
,name:
or{name}:
- Dynamic identifiers, which are not bound in any enclosing scope
Fields§
§static_upvalues: Vec<Value>
The upvalues of static identifiers. Each static identifier is assigned an integer identifier at compile time, which is an index into this Vec.
with_stack: Option<Vec<Value>>
The upvalues of dynamic identifiers, if any exist. This
consists of the value passed to each enclosing with val;
,
from outermost to innermost.
Implementations§
source§impl Upvalues
impl Upvalues
pub fn with_capacity(count: usize) -> Self
sourcepub fn set_with_stack(&mut self, with_stack: Vec<Value>)
pub fn set_with_stack(&mut self, with_stack: Vec<Value>)
Set the captured with stack.
pub fn with_stack(&self) -> Option<&Vec<Value>>
pub fn with_stack_len(&self) -> usize
sourcepub fn resolve_deferred_upvalues(&mut self, stack: &[Value])
pub fn resolve_deferred_upvalues(&mut self, stack: &[Value])
Resolve deferred upvalues from the provided stack slice, mutating them in the internal upvalue slots.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Upvalues
impl !RefUnwindSafe for Upvalues
impl !Send for Upvalues
impl !Sync for Upvalues
impl Unpin for Upvalues
impl !UnwindSafe for Upvalues
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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