Trait FieldDerefMut

Source
pub unsafe trait FieldDerefMut {
    type Target<'a>
       where Self: 'a;

    // Required method
    fn deref_mut(&mut self) -> Self::Target<'_>;
}
Expand description

Types that can be used by get_mut and to derive CompactBorrowMut.

It’s like DerefMut but with flexible targets and strict constraints.

§Safety

T must not deref_mut to something that points to its own memory.

A counter-example is ManuallyDrop<T>, which will deref_mut to &mut T.

Required Associated Types§

Source

type Target<'a> where Self: 'a

Required Methods§

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> FieldDerefMut for Option<&mut T>

Source§

type Target<'a> = Option<&'a mut T> where Self: 'a

Source§

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

Source§

impl<T> FieldDerefMut for Option<Box<T>>

Source§

type Target<'a> = Option<&'a mut T> where Self: 'a

Source§

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

Source§

impl<T> FieldDerefMut for &mut T

Source§

type Target<'a> = &'a mut T where Self: 'a

Source§

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

Source§

impl<T> FieldDerefMut for Box<T>

Source§

type Target<'a> = &'a mut T where Self: 'a

Source§

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

Implementors§