[][src]Struct structural::mut_ref::MutRef

#[repr(transparent)]
pub struct MutRef<'a, T: ?Sized> {
    pub ptr: *mut T,
    // some fields omitted
}

A wrapper type that associates a mutable raw pointer with a lifetime.

Motivation

This type was declared to pass a mutable-reference-like type to multiple methods to borrow multiple fields individually. If those methods took in mutable references it would cause undefined behavior to borrow multiple fields mutably, since each call borrows the entire data structure.

Fields

ptr: *mut T

Methods

impl<'a, T: ?Sized> MutRef<'a, T>[src]

pub fn new(mut_ref: &'a mut T) -> Self[src]

Constructs a MutRef from a mutable reference.

pub fn from_ptr(ptr: *mut T) -> Self[src]

Constructs a MutRef from a mutable pointer.

pub fn cast<U>(self) -> MutRef<'a, U>[src]

An unchecked cast from MutRef<'a,T> to MutRef<'a,U>.

Trait Implementations

impl<'a, T: ?Sized> From<&'a mut T> for MutRef<'a, T>[src]

impl<'a, T: ?Sized> Clone for MutRef<'a, T>[src]

impl<'a, T: ?Sized> Copy for MutRef<'a, T>[src]

impl<'a, T: Debug + ?Sized> Debug for MutRef<'a, T>[src]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

impl<T> GetFieldExt for T where
    T: ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> TypeIdentity for T where
    T: ?Sized
[src]

type Type = T

The same type as Self. Read more

impl<T> SelfOps for T where
    T: ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The error type returned when the conversion fails.