Struct wasmtime_runtime::SendSyncPtr
source · #[repr(transparent)]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.
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>where
U: Into<NonNull<T>>,
impl<T: ?Sized, U> From<U> for SendSyncPtr<T>where U: Into<NonNull<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> PartialEq<SendSyncPtr<T>> for SendSyncPtr<T>
impl<T: ?Sized> PartialEq<SendSyncPtr<T>> 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: ?Sized> RefUnwindSafe for SendSyncPtr<T>where T: RefUnwindSafe,
impl<T: ?Sized> Unpin for SendSyncPtr<T>
impl<T: ?Sized> UnwindSafe for SendSyncPtr<T>where T: RefUnwindSafe,
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 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.