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>
impl<'a, T: ?Sized> MoveRef<'a, T>
Sourcepub unsafe fn new_unchecked(ptr: &'a mut T, drop_flag: DropFlag<'a>) -> Self
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.
Sourcepub fn into_pin(this: Self) -> Pin<Self>
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.
Sourcepub fn as_ptr(this: &Self) -> *const T
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.
Sourcepub fn as_mut_ptr(this: &mut Self) -> *mut T
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>
impl<'a, T> MoveRef<'a, T>
Sourcepub fn into_inner(this: Self) -> T
pub fn into_inner(this: Self) -> T
Consume the MoveRef<T>, returning the wrapped value.