Struct wasmtime_runtime::SendSyncPtr
source · pub struct SendSyncPtr<T: ?Sized>(/* private fields */);
Expand description
A helper type in Wasmtime to store a raw pointer to T
while automatically
inferring the Send
and Sync
traits for the container based on the
properties of T
.
Implementations§
source§impl<T: ?Sized> SendSyncPtr<T>
impl<T: ?Sized> SendSyncPtr<T>
sourcepub fn new(ptr: NonNull<T>) -> SendSyncPtr<T>
pub fn new(ptr: NonNull<T>) -> SendSyncPtr<T>
Creates a new pointer wrapping the non-nullable pointer provided.
sourcepub unsafe fn as_ref<'a>(&self) -> &'a T
pub unsafe fn as_ref<'a>(&self) -> &'a T
Unsafely assert that this is a pointer to valid contents and it’s also valid to get a shared reference to it at this time.
sourcepub unsafe fn as_mut<'a>(&mut self) -> &'a mut T
pub unsafe fn as_mut<'a>(&mut self) -> &'a mut T
Unsafely assert that this is a pointer to valid contents and it’s also valid to get a mutable reference to it at this time.
sourcepub fn as_non_null(&self) -> NonNull<T>
pub fn as_non_null(&self) -> NonNull<T>
Returns the underlying NonNull<T>
wrapper.
sourcepub fn cast<U>(&self) -> SendSyncPtr<U>
pub fn cast<U>(&self) -> SendSyncPtr<U>
Cast this to a pointer to a U
.
Trait Implementations§
source§impl<T: ?Sized> Clone for SendSyncPtr<T>
impl<T: ?Sized> Clone for SendSyncPtr<T>
source§impl<T: ?Sized> Debug for SendSyncPtr<T>
impl<T: ?Sized> Debug for SendSyncPtr<T>
source§impl<T: ?Sized, U> From<U> for SendSyncPtr<T>
impl<T: ?Sized, U> From<U> for SendSyncPtr<T>
source§fn from(ptr: U) -> SendSyncPtr<T>
fn from(ptr: U) -> SendSyncPtr<T>
Converts to this type from the input type.
source§impl<T: ?Sized> Hash for SendSyncPtr<T>
impl<T: ?Sized> Hash for SendSyncPtr<T>
source§impl<T: ?Sized> PartialEq for SendSyncPtr<T>
impl<T: ?Sized> PartialEq for SendSyncPtr<T>
source§fn eq(&self, other: &SendSyncPtr<T>) -> bool
fn eq(&self, other: &SendSyncPtr<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T: ?Sized> Pointer for SendSyncPtr<T>
impl<T: ?Sized> Pointer for SendSyncPtr<T>
impl<T: ?Sized> Copy for SendSyncPtr<T>
impl<T: ?Sized> Eq for SendSyncPtr<T>
impl<T: Send + ?Sized> Send for SendSyncPtr<T>
impl<T: Sync + ?Sized> Sync for SendSyncPtr<T>
Auto Trait Implementations§
impl<T> Freeze for SendSyncPtr<T>where
T: ?Sized,
impl<T> RefUnwindSafe for SendSyncPtr<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Unpin for SendSyncPtr<T>where
T: ?Sized,
impl<T> UnwindSafe for SendSyncPtr<T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.