Trait abi_stable::pointer_trait::GetPointerKind
source · 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§
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
:Self
must be a&T
, or aCopy
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.
Provided Associated Constants§
sourceconst KIND: PointerKind = <Self::Kind as PointerKindVariant>::VALUE
const KIND: PointerKind = <Self::Kind as PointerKindVariant>::VALUE
Object Safety§
This trait is not object safe.