Struct Slot

Source
#[repr(C)]
pub struct Slot { pub start: *mut c_void, pub heap: *mut c_void, pub stack: *mut c_void, pub globals: *mut c_void, pub sigstack: *mut c_void, pub limits: Limits, pub region: Weak<dyn RegionInternal>, }
Expand description

A set of pointers into virtual memory that can be allocated into an Alloc.

The 'r lifetime parameter represents the lifetime of the region that backs this virtual address space.

The memory layout in a Slot is meant to be reused in order to reduce overhead on region implementations. To back the layout with real memory, use Region::allocate_runtime.

To ensure a Slot can only be backed by one allocation at a time, it contains a mutex, but otherwise can be freely copied.

Fields§

§start: *mut c_void

The beginning of the contiguous virtual memory chunk managed by this Alloc.

The first part of this memory, pointed to by start, is always backed by real memory, and is used to store the lucet_instance structure.

§heap: *mut c_void

The next part of memory contains the heap and its guard pages.

The heap is backed by real memory according to the HeapSpec. Guard pages trigger a sigsegv when accessed.

§stack: *mut c_void

The stack comes after the heap.

Because the stack grows downwards, we get the added safety of ensuring that stack overflows go into the guard pages, if the Limits specify guard pages. The stack is always the size given by Limits.stack_pages.

§globals: *mut c_void

The WebAssembly Globals follow the stack and a single guard page.

§sigstack: *mut c_void

The signal handler stack follows the globals.

Having a separate signal handler stack allows the signal handler to run in situations where the normal stack has grown into the guard page.

§limits: Limits

Limits of the memory.

Should not change through the lifetime of the Alloc.

§region: Weak<dyn RegionInternal>

Implementations§

Trait Implementations§

Auto Trait Implementations§

§

impl Freeze for Slot

§

impl !RefUnwindSafe for Slot

§

impl Unpin for Slot

§

impl !UnwindSafe for Slot

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> Same for T

Source§

type Output = T

Should always be Self
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.