MutableHandle

Struct MutableHandle 

Source
#[repr(C)]
pub struct MutableHandle<T> { pub _phantom_0: PhantomData<UnsafeCell<T>>, pub ptr: *mut T, }
Expand description

Similar to a handle, but the underlying storage can be changed. This is useful for outparams.

If you want to add additional methods to MutableHandle for a specific specialization, define a MutableHandleOperations specialization containing them.

Fields§

§_phantom_0: PhantomData<UnsafeCell<T>>§ptr: *mut T

Implementations§

Source§

impl<T> MutableHandle<T>

Source

pub unsafe fn from_marked_location(ptr: *mut T) -> MutableHandle<T>

Source

pub fn handle(&self) -> Handle<T>

Source

pub fn get(&self) -> T
where T: Copy,

Source

pub fn set(&self, v: T)
where T: Copy,

Source

pub fn as_ptr(self) -> *mut T

The returned pointer is aliased by a pointer that the GC will read through, and thus &mut references created from it must not be held across GC pauses.

Trait Implementations§

Source§

impl<T: Clone> Clone for MutableHandle<T>

Source§

fn clone(&self) -> MutableHandle<T>

Returns a duplicate 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: Debug> Debug for MutableHandle<T>

Source§

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

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

impl<T> Deref for MutableHandle<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref<'a>(&'a self) -> &'a T

Dereferences the value.
Source§

impl<T: IntoMutableHandle> From<T> for MutableHandle<T::Target>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq> PartialEq for MutableHandle<T>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Copy> Copy for MutableHandle<T>

Source§

impl<T> StructuralPartialEq for MutableHandle<T>

Auto Trait Implementations§

§

impl<T> Freeze for MutableHandle<T>

§

impl<T> !RefUnwindSafe for MutableHandle<T>

§

impl<T> !Send for MutableHandle<T>

§

impl<T> !Sync for MutableHandle<T>

§

impl<T> Unpin for MutableHandle<T>
where T: Unpin,

§

impl<T> UnwindSafe for MutableHandle<T>

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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>,

Source§

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>,

Source§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 8 bytes