pub struct FiberStack(/* private fields */);
Expand description
Represents an execution stack to use for a fiber.
Implementations§
source§impl FiberStack
impl FiberStack
sourcepub fn from_custom(custom: Box<dyn RuntimeFiberStack>) -> Result<Self>
pub fn from_custom(custom: Box<dyn RuntimeFiberStack>) -> Result<Self>
Creates a new fiber stack of the given size.
sourcepub unsafe fn from_raw_parts(bottom: *mut u8, len: usize) -> Result<Self>
pub unsafe fn from_raw_parts(bottom: *mut u8, len: usize) -> Result<Self>
Creates a new fiber stack with the given pointer to the bottom of the stack plus the byte length of the stack.
The bottom
pointer should be addressable for len
bytes. The page
beneath bottom
should be unmapped as a guard page.
§Safety
This is unsafe because there is no validation of the given pointer.
The caller must properly allocate the stack space with a guard page and make the pages accessible for correct behavior.
sourcepub fn top(&self) -> Option<*mut u8>
pub fn top(&self) -> Option<*mut u8>
Gets the top of the stack.
Returns None
if the platform does not support getting the top of the
stack.
sourcepub fn range(&self) -> Option<Range<usize>>
pub fn range(&self) -> Option<Range<usize>>
Returns the range of where this stack resides in memory if the platform supports it.
sourcepub fn is_from_raw_parts(&self) -> bool
pub fn is_from_raw_parts(&self) -> bool
Is this a manually-managed stack created from raw parts? If so, it is up to whoever created it to manage the stack’s memory allocation.