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,
guard_size: usize,
len: usize,
) -> Result<Self>
pub unsafe fn from_raw_parts( bottom: *mut u8, guard_size: usize, len: usize, ) -> Result<Self>
Creates a new fiber stack with the given pointer to the bottom of the stack plus how large the guard size and stack size are.
The bytes from bottom
to bottom.add(guard_size)
should all be
guaranteed to be unmapped. The bytes from bottom.add(guard_size)
to
bottom.add(guard_size + len)
should be addressable.
§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.