Struct wasmer::store::StoreHandle
pub struct StoreHandle<T> {
id: StoreId,
internal: InternalStoreHandle<T>,
}
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.
Fields§
§id: StoreId
§internal: InternalStoreHandle<T>
Implementations§
§impl<T> StoreHandle<T>where
T: StoreObject,
impl<T> StoreHandle<T>where T: StoreObject,
pub fn new(ctx: &mut StoreObjects, val: T) -> StoreHandle<T>
pub fn new(ctx: &mut StoreObjects, val: T) -> StoreHandle<T>
Moves the given object into a context and returns a handle to it.
pub 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.
pub 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.
pub fn internal_handle(&self) -> InternalStoreHandle<T>
pub fn internal_handle(&self) -> InternalStoreHandle<T>
Returns the internal handle contains within this handle.
pub 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
pub unsafe fn from_internal(
id: StoreId,
internal: InternalStoreHandle<T>
) -> StoreHandle<T>
pub unsafe fn from_internal( id: StoreId, internal: InternalStoreHandle<T> ) -> StoreHandle<T>
Constructs a StoreHandle
from a StoreId
and an InternalStoreHandle
.
Safety
Handling InternalStoreHandle
values is unsafe because they do not track context ID.
Trait Implementations§
§impl<T> Clone for StoreHandle<T>
impl<T> Clone for StoreHandle<T>
§fn clone(&self) -> StoreHandle<T>
fn clone(&self) -> StoreHandle<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<T> Debug for StoreHandle<T>where
T: StoreObject,
impl<T> Debug for StoreHandle<T>where T: StoreObject,
source§impl From<StoreHandle<VMFunction>> for Function
impl From<StoreHandle<VMFunction>> for Function
source§fn from(handle: StoreHandle<VMFunction>) -> Self
fn from(handle: StoreHandle<VMFunction>) -> Self
Converts to this type from the input type.
§impl<T> Hash for StoreHandle<T>
impl<T> Hash for StoreHandle<T>
§impl<T> PartialEq<StoreHandle<T>> for StoreHandle<T>where
T: StoreObject,
impl<T> PartialEq<StoreHandle<T>> for StoreHandle<T>where T: StoreObject,
§fn eq(&self, other: &StoreHandle<T>) -> bool
fn eq(&self, other: &StoreHandle<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<T> Eq for StoreHandle<T>where T: StoreObject,
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<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,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§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,
§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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§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.
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Upcastable for Twhere
T: Any + Send + Sync + 'static,
impl<T> Upcastable for Twhere T: Any + Send + Sync + 'static,
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref