Struct wasmer_vm::StoreHandle
source · pub struct StoreHandle<T> { /* private fields */ }
Expand description
Handle to an object managed by a context.
Internally this is just an integer index into a context. A reference to the context must be passed in separately to access the actual object.
Implementations§
source§impl<T: StoreObject> StoreHandle<T>
impl<T: StoreObject> StoreHandle<T>
sourcepub fn new(ctx: &mut StoreObjects, val: T) -> Self
pub fn new(ctx: &mut StoreObjects, val: T) -> Self
Moves the given object into a context and returns a handle to it.
sourcepub fn get<'a>(&self, ctx: &'a StoreObjects) -> &'a T
pub fn get<'a>(&self, ctx: &'a StoreObjects) -> &'a T
Returns a reference to the object that this handle points to.
sourcepub fn get_mut<'a>(&self, ctx: &'a mut StoreObjects) -> &'a mut T
pub fn get_mut<'a>(&self, ctx: &'a mut StoreObjects) -> &'a mut T
Returns a mutable reference to the object that this handle points to.
sourcepub fn internal_handle(&self) -> InternalStoreHandle<T>
pub fn internal_handle(&self) -> InternalStoreHandle<T>
Returns the internal handle contains within this handle.
sourcepub fn set_store_id(&mut self, id: StoreId)
pub fn set_store_id(&mut self, id: StoreId)
Overrides the store id with a new ID
sourcepub unsafe fn from_internal(
id: StoreId,
internal: InternalStoreHandle<T>
) -> Self
pub unsafe fn from_internal( id: StoreId, internal: InternalStoreHandle<T> ) -> Self
Constructs a StoreHandle
from a StoreId
and an InternalStoreHandle
.
Safety
Handling InternalStoreHandle
values is unsafe because they do not track context ID.
Trait Implementations§
source§impl<T> Clone for StoreHandle<T>
impl<T> Clone for StoreHandle<T>
source§impl<T: StoreObject> Debug for StoreHandle<T>
impl<T: StoreObject> Debug for StoreHandle<T>
source§impl<T> Hash for StoreHandle<T>
impl<T> Hash for StoreHandle<T>
source§impl<T: StoreObject> PartialEq<StoreHandle<T>> for StoreHandle<T>
impl<T: StoreObject> PartialEq<StoreHandle<T>> for StoreHandle<T>
impl<T: StoreObject> Eq for StoreHandle<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for StoreHandle<T>
impl<T> Send for StoreHandle<T>
impl<T> Sync for StoreHandle<T>
impl<T> Unpin for StoreHandle<T>
impl<T> UnwindSafe for StoreHandle<T>
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.