Struct Out

Source
pub struct Out<'a, T: ?Sized>(/* private fields */);
Expand description

An Out Reference, you can only write to this reference using the set method and reborrow this reference with the borrow method. It isn’t safe to read from an Out pointer.

Implementations§

Source§

impl<'a, T> Out<'a, T>

Source

pub fn from_maybe_uninit(maybe_uninit: &mut MaybeUninit<T>) -> Out<'_, T>

To allow writing to the value inside the MaybeUninit

Source§

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

Source

pub fn from_mut(value: &'a mut T) -> Self

Create Out from exclusive reference

Source

pub unsafe fn from_raw(ptr: *mut T) -> Out<'a, T>

Create Out from raw pointer

Source

pub fn borrow(&mut self) -> Out<'_, T>

Reborrows the Out reference

Source

pub fn into_raw(self) -> *mut T

Convert this Out reference into a raw pointer

see as_mut_ptr for safety documentation of the this pointer.

Source

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

Get a raw pointer to the Out, it is only safe to write to this pointer unless specified otherwise by the creator of this Out reference

i.e. it’s safe to read to an Out<'_, T> that was created from a &mut T and it’s safe to read from a Out<'_, T> that was created from a &mut MaybeUninit<T> after it has been initialized.

Source§

impl<'a, T> Out<'a, T>

Source

pub fn set(&mut self, value: T)

Set the value behind the Out reference *without dropping the old value *

Trait Implementations§

Source§

impl<'a, T: Debug + ?Sized> Debug for Out<'a, T>

Source§

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

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

impl<'a, T> From<&'a mut MaybeUninit<T>> for Out<'a, T>

Source§

fn from(ptr: &'a mut MaybeUninit<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: ?Sized> From<&'a mut T> for Out<'a, T>

Source§

fn from(ptr: &'a mut T) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Out<'a, T>
where T: ?Sized,

§

impl<'a, T> RefUnwindSafe for Out<'a, T>
where T: RefUnwindSafe + ?Sized,

§

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

§

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

§

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

§

impl<'a, T> !UnwindSafe for Out<'a, 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> 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> OutMethod for T
where T: ?Sized,

Source§

fn out(&mut self) -> Out<'_, Self>

creates an Out ref
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.