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>

source

pub fn new(ptr: NonNull<T>) -> SendSyncPtr<T>

Creates a new pointer wrapping the non-nullable pointer provided.

source

pub fn as_ptr(&self) -> *mut T

Returns the underlying raw pointer.

source

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.

source

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.

source

pub fn as_non_null(&self) -> NonNull<T>

Returns the underlying NonNull<T> wrapper.

source§

impl<T> SendSyncPtr<[T]>

source

pub fn len(&self) -> usize

Returns the slice’s length component of the pointer.

Trait Implementations§

source§

impl<T: ?Sized> Clone for SendSyncPtr<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: ?Sized> Debug for SendSyncPtr<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: ?Sized, U> From<U> for SendSyncPtr<T>
where U: Into<NonNull<T>>,

source§

fn from(ptr: U) -> SendSyncPtr<T>

Converts to this type from the input type.
source§

impl<T: ?Sized> PartialEq for SendSyncPtr<T>

source§

fn eq(&self, other: &SendSyncPtr<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: ?Sized> Pointer for SendSyncPtr<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<T: ?Sized> Copy for SendSyncPtr<T>

source§

impl<T: ?Sized> Eq for SendSyncPtr<T>

source§

impl<T: Send + ?Sized> Send for SendSyncPtr<T>

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.