MCPcopy Index your code
hub / github.com/RustPython/RustPython / stack_as_slice

Method stack_as_slice

crates/vm/src/frame.rs:336–341  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

334 /// Immutable view of the active stack as `Option<PyStackRef>` slice.
335 #[inline(always)]
336 fn stack_as_slice(&self) -> &[Option<PyStackRef>] {
337 let data = self.data_as_slice();
338 let base = self.nlocalsplus as usize;
339 let ptr = unsafe { (data.as_ptr().add(base)) as *const Option<PyStackRef> };
340 unsafe { core::slice::from_raw_parts(ptr, self.stack_top as usize) }
341 }
342
343 /// Get a reference to a stack slot by index from the bottom.
344 #[inline(always)]

Callers 2

traverseMethod · 0.80
fmtMethod · 0.80

Calls 3

data_as_sliceMethod · 0.80
addMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected