Struct moveit::move_ref::MoveRef

source ·
pub struct MoveRef<'a, T: ?Sized> { /* private fields */ }
Expand description

A MoveRef<'a, T> represents an owned T whose storage location is valid but unspecified.

See the module documentation for more details.

Implementations§

source§

impl<'a, T: ?Sized> MoveRef<'a, T>

source

pub unsafe fn new_unchecked(ptr: &'a mut T, drop_flag: DropFlag<'a>) -> Self

Creates a new MoveRef<T> out of a mutable reference.

Safety

ptr must satisfy the longest-lived criterion: after the return value goes out of scope, ptr must also be out-of-scope. Calling this function correctly is non-trivial, and should be left to moveit!() instead.

In particular, if ptr outlives the returned MoveRef, it will point to dropped memory, which is UB.

drop_flag’s value must not be dead, and must be a drop flag governing the destruction of ptr’s storage in an appropriate manner as described in moveit::drop_flag.

source

pub fn into_pin(this: Self) -> Pin<Self>

Converts a MoveRef<T> into a Pin<MoveRef<T>>.

Because we own the referent, we are entitled to pin it permanently. See Box::into_pin() for a standard-library equivalent.

source

pub fn as_ptr(this: &Self) -> *const T

Returns this MoveRef<T> as a raw pointer, without creating an intermediate reference.

The usual caveats for casting a reference to a pointer apply.

source

pub fn as_mut_ptr(this: &mut Self) -> *mut T

Returns this MoveRef<T> as a raw mutable pointer, without creating an intermediate reference.

The usual caveats for casting a reference to a pointer apply.

source§

impl<'a, T> MoveRef<'a, T>

source

pub fn into_inner(this: Self) -> T

Consume the MoveRef<T>, returning the wrapped value.

Trait Implementations§

source§

impl<'f, T: ?Sized> AsMove for MoveRef<'f, T>

§

type Storage = ()

The “pure storage” form of Self, which owns the storage but not the pointee.
source§

fn as_move<'frame>( self, storage: DroppingSlot<'frame, Self::Storage> ) -> Pin<MoveRef<'frame, Self::Target>>where Self: 'frame,

Gets a pinned MoveRef out of Self. Read more
source§

impl<T: ?Sized> Deref for MoveRef<'_, T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a, T: ?Sized> DerefMove for MoveRef<'a, T>

source§

fn deref_move<'frame>( self, _storage: DroppingSlot<'frame, Self::Storage> ) -> MoveRef<'frame, Self::Target>where Self: 'frame,

Moves out of self, producing a MoveRef that owns its contents. Read more
source§

impl<T: ?Sized> DerefMut for MoveRef<'_, T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<T: ?Sized> Drop for MoveRef<'_, T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a, T> From<MoveRef<'a, T>> for Pin<MoveRef<'a, T>>

source§

fn from(x: MoveRef<'a, T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, T> !RefUnwindSafe for MoveRef<'a, T>

§

impl<'a, T> !Send for MoveRef<'a, T>

§

impl<'a, T> !Sync for MoveRef<'a, T>

§

impl<'a, T: ?Sized> Unpin for MoveRef<'a, T>

§

impl<'a, T> !UnwindSafe for MoveRef<'a, T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.