Trait FieldDeref

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

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

Types that can be used by get_ref and to derive CompactBorrow.

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

§Safety

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

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

Required Associated Types§

Source

type Target<'a> where Self: 'a

Required Methods§

Source

fn deref(&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> FieldDeref for Option<&T>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<T> FieldDeref for Option<Box<T>>

Source§

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

Source§

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

Source§

impl<T> FieldDeref for Option<Rc<T>>

Source§

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

Source§

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

Source§

impl<T> FieldDeref for Option<Arc<T>>

Source§

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

Source§

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

Source§

impl<T> FieldDeref for &T

Source§

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

Source§

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

Source§

impl<T> FieldDeref for &mut T

Source§

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

Source§

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

Source§

impl<T> FieldDeref for Box<T>

Source§

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

Source§

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

Source§

impl<T> FieldDeref for Rc<T>

Source§

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

Source§

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

Source§

impl<T> FieldDeref for Arc<T>

Source§

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

Source§

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

Implementors§