pub unsafe trait GetPointerKind: Sized {
    type Kind: PointerKindVariant;
    type PtrTarget;

    const KIND: PointerKind = <Self::Kind as PointerKindVariant>::VALUE;
}
Expand description

What kind of pointer this is.

Safety

Each associated item describes their requirements for the implementor.

Required Associated Types§

source

type Kind: PointerKindVariant

The kind of the pointer.

Safety for implementor

This is what each kind requires to be used as this associated type:

  • PK_Reference: Self must be a &T, or a Copy and #[repr(transparent)] wrapper around a raw pointer or reference, with &T semantics. Note that converting into and then back from &Self::PtrTarget might be a lossy operation for such a type and therefore incorrect.

  • PK_MutReference: Self must be a &mut T, or a non-Drop and #[repr(transparent)] wrapper around a primitive pointer, with &mut T semantics.

  • PK_SmartPointer: Any pointer type that’s neither of the two other kinds.

source

type PtrTarget

What this pointer points to.

This is here so that pointers don’t have to implement Deref.

Safety for implementor

If the type implements std::ops::Deref this must be the same as <Self as Deref>::Target.

Provided Associated Constants§

source

const KIND: PointerKind = <Self::Kind as PointerKindVariant>::VALUE

The value-level version of the Kind associated type.

Safety for implementor

This must not be overriden.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T> GetPointerKind for &'a T

source§

impl<'a, T> GetPointerKind for &'a mut T

Implementors§

source§

impl GetPointerKind for Module_Ref

source§

impl<'a, T> GetPointerKind for RMut<'a, T>

source§

impl<'a, T> GetPointerKind for RRef<'a, T>

source§

impl<'borr, ErasedPtr, I> GetPointerKind for VTable_Ref<'borr, ErasedPtr, I>

§

type PtrTarget = WithMetadata_<VTable_Prefix<'borr, ErasedPtr, I>, VTable_Prefix<'borr, ErasedPtr, I>>

§

type Kind = PK_Reference

source§

impl<P> GetPointerKind for PrefixRef<P>

source§

impl<T> GetPointerKind for StaticRef<T>

source§

impl<T> GetPointerKind for RArc<T>

source§

impl<T> GetPointerKind for RBox<T>

source§

impl<T, Inline> GetPointerKind for RSmallBox<T, Inline>

source§

impl<T: Copy> GetPointerKind for PhantModule_Ref<T>