pub struct LocalsPlus { /* private fields */ }Expand description
Unified storage for local variables and evaluation stack.
Memory layout (each slot is usize-sized):
[0..nlocalsplus) — fastlocals (Option<PyObjectRef>)
[nlocalsplus..nlocalsplus+stack_top) — active evaluation stack (Option<PyStackRef>)
[nlocalsplus+stack_top..capacity) — unused stack capacity
Both Option<PyObjectRef> and Option<PyStackRef> are usize-sized
(niche optimization on NonNull / NonZeroUsize). The raw storage is
usize to unify them; typed access is provided through methods.
Trait Implementations§
Source§impl Drop for LocalsPlus
impl Drop for LocalsPlus
Source§impl Traverse for LocalsPlus
impl Traverse for LocalsPlus
Source§fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
fn traverse(&self, tracer_fn: &mut TraverseFn<'_>)
impl
traverse() with caution! Following those guideline so traverse doesn’t cause memory error!: Read moreSource§fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
fn clear(&mut self, _out: &mut Vec<PyObjectRef>)
Extract all owned child PyObjectRefs for circular reference resolution (tp_clear).
Called just before object deallocation to break circular references.
Default implementation does nothing.
Auto Trait Implementations§
impl Freeze for LocalsPlus
impl RefUnwindSafe for LocalsPlus
impl !Send for LocalsPlus
impl !Sync for LocalsPlus
impl Unpin for LocalsPlus
impl UnsafeUnpin for LocalsPlus
impl UnwindSafe for LocalsPlus
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> 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