Struct wasmtime_runtime::StoreBox

source ·
pub struct StoreBox<T: ?Sized>(/* private fields */);
Expand description

A Box<T> lookalike for memory that’s stored in a Store<T>

This is intended to be quite similar to a Box<T> except without the Deref implementations. The main motivation for this type’s existence is to appease the aliasing rules in miri to ensure that StoreBox can be moved around without invalidating pointers to the contents within the box. The standard Box<T> type does not implement this for example and moving that will invalidate derived pointers.

Implementations§

source§

impl<T> StoreBox<T>

source

pub fn new(val: T) -> StoreBox<T>

Allocates space on the heap to store val and returns a pointer to it living on the heap.

source§

impl<T: ?Sized> StoreBox<T>

source

pub fn get(&self) -> *mut T

Returns the underlying pointer to T which is owned by the store.

Trait Implementations§

source§

impl<T: ?Sized> Drop for StoreBox<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: Send + ?Sized> Send for StoreBox<T>

source§

impl<T: Sync + ?Sized> Sync for StoreBox<T>

Auto Trait Implementations§

§

impl<T> Freeze for StoreBox<T>
where T: ?Sized,

§

impl<T> RefUnwindSafe for StoreBox<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Unpin for StoreBox<T>
where T: ?Sized,

§

impl<T> UnwindSafe for StoreBox<T>
where T: RefUnwindSafe + ?Sized,

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>,

§

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>,

§

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.