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.
Provided Associated Constants§
Sourceconst KIND: PointerKind = <Self::Kind as PointerKindVariant>::VALUE
const KIND: PointerKind = <Self::Kind as PointerKindVariant>::VALUE
Required Associated Types§
Sourcetype Kind: PointerKindVariant
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:Selfmust be a&T, or aCopyand#[repr(transparent)]wrapper around a raw pointer or reference, with&Tsemantics. Note that converting into and then back from&Self::PtrTargetmight be a lossy operation for such a type and therefore incorrect. -
PK_MutReference:Selfmust be a&mut T, or a non-Dropand#[repr(transparent)]wrapper around a primitive pointer, with&mut Tsemantics. -
PK_SmartPointer: Any pointer type that’s neither of the two other kinds.
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.