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: ?Sized> RefUnwindSafe for StoreBox<T>where T: RefUnwindSafe,

§

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

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.