wasmtime_fiber

Struct FiberStack

Source
pub struct FiberStack(/* private fields */);
Expand description

Represents an execution stack to use for a fiber.

Implementations§

Source§

impl FiberStack

Source

pub fn new(size: usize) -> Result<Self>

Creates a new fiber stack of the given size.

Source

pub fn from_custom(custom: Box<dyn RuntimeFiberStack>) -> Result<Self>

Creates a new fiber stack of the given size.

Source

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.

Source

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.

Source

pub fn range(&self) -> Option<Range<usize>>

Returns the range of where this stack resides in memory if the platform supports it.

Source

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.

Source

pub fn guard_range(&self) -> Option<Range<*mut u8>>

Returns the range of memory that the guard page(s) reside in.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.