Trait abi_stable::abi_stability::stable_abi_trait::StableAbi [−][src]
pub unsafe trait StableAbi: GetStaticEquivalent_ {
type IsNonZeroType: Boolean;
const LAYOUT: &'static TypeLayout;
const ABI_CONSTS: AbiConsts;
}
Expand description
Represents a type whose layout is stable.
This trait can be derived using #[derive(StableAbi)]
.
Safety
The layout specified in LAYOUT
must be correct,
otherwise type checking when loading a dynamic library would be unsound,
and passing this into a dynamic library would be equivalent to transmuting it.
Caveats
This trait cannot be directly implemented for functions that take lifetime parameters,
because of that,#[derive(StableAbi)]
detects the presence of extern fn
types
in type definitions.
Associated Types
type IsNonZeroType: Boolean
type IsNonZeroType: Boolean
Whether this type has a single invalid bit-pattern.
Possible values:True/False
Some standard library types have a single value that is invalid for them eg:0,null.
these types are the only ones which can be stored in a Option<_>
that implements StableAbi.
An alternative for types where IsNonZeroType=False
,you can use ROption
.
Non-exhaustive list of std types that are NonZero:
-
&T
(any T). -
&mut T
(any T). -
extern "C" fn()
. -
std::ptr::NonNull
-
std::num::NonZero*
Associated Constants
const LAYOUT: &'static TypeLayout
const LAYOUT: &'static TypeLayout
The layout of the type provided by implementors.
const ABI_CONSTS: AbiConsts
const ABI_CONSTS: AbiConsts
const
-equivalents of the associated types.
Implementations on Foreign Types
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
type IsNonZeroType = False
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
type IsNonZeroType = False
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
T13: StableAbi,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
T13: StableAbi,
type IsNonZeroType = False
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
T13: StableAbi,
T14: StableAbi,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
T13: StableAbi,
T14: StableAbi,
type IsNonZeroType = False
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
T13: StableAbi,
T14: StableAbi,
T15: StableAbi,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> StableAbi for PhantomData<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> where
T0: StableAbi,
T1: StableAbi,
T2: StableAbi,
T3: StableAbi,
T4: StableAbi,
T5: StableAbi,
T6: StableAbi,
T7: StableAbi,
T8: StableAbi,
T9: StableAbi,
T10: StableAbi,
T11: StableAbi,
T12: StableAbi,
T13: StableAbi,
T14: StableAbi,
T15: StableAbi,
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
When the “const_params” feature is disabled, this trait is implemented for arrays of up to 32 elements.
type IsNonZeroType = False
Implementing abi stability for Option
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = True
type IsNonZeroType = False
type IsNonZeroType = P::IsNonZeroType
type IsNonZeroType = P::IsNonZeroType
type IsNonZeroType = P::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = True
type IsNonZeroType = True
Implementors
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <RString as __StableAbi>::IsNonZeroType
type IsNonZeroType = True
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <RRef<'static, AbiHeader> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <RStr<'static> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <u8 as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = <u64 as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <Option<&'static TLNonExhaustive> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = <u8 as __StableAbi>::IsNonZeroType
type IsNonZeroType = <u32 as __StableAbi>::IsNonZeroType
type IsNonZeroType = <u8 as __StableAbi>::IsNonZeroType
type IsNonZeroType = <u32 as __StableAbi>::IsNonZeroType
type IsNonZeroType = <NulStr<'static> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <u8 as __StableAbi>::IsNonZeroType
type IsNonZeroType = <u16 as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = <u32 as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <u16 as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = True
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <RStr<'a> as __StableAbi>::IsNonZeroType
type IsNonZeroType = <NonNull<u8> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
impl<'a, B> StableAbi for RCow<'a, B> where
B: BorrowOwned<'a> + ?Sized,
B: __GetStaticEquivalent_,
<B as BorrowOwned<'a>>::RBorrowed: StableAbi,
<B as BorrowOwned<'a>>::ROwned: StableAbi,
impl<'a, B> StableAbi for RCow<'a, B> where
B: BorrowOwned<'a> + ?Sized,
B: __GetStaticEquivalent_,
<B as BorrowOwned<'a>>::RBorrowed: StableAbi,
<B as BorrowOwned<'a>>::ROwned: StableAbi,
type IsNonZeroType = False
impl<'a, K, V> StableAbi for REntry<'a, K, V> where
K: __StableAbi,
V: __StableAbi,
K: 'a,
V: 'a,
impl<'a, K, V> StableAbi for REntry<'a, K, V> where
K: __StableAbi,
V: __StableAbi,
K: 'a,
V: 'a,
type IsNonZeroType = False
impl<'a, K, V> StableAbi for ROccupiedEntry<'a, K, V> where
K: __StableAbi,
V: __StableAbi,
K: 'a,
V: 'a,
impl<'a, K, V> StableAbi for ROccupiedEntry<'a, K, V> where
K: __StableAbi,
V: __StableAbi,
K: 'a,
V: 'a,
type IsNonZeroType = False
impl<'a, K, V> StableAbi for RVacantEntry<'a, K, V> where
K: __StableAbi,
V: __StableAbi,
K: 'a,
V: 'a,
impl<'a, K, V> StableAbi for RVacantEntry<'a, K, V> where
K: __StableAbi,
V: __StableAbi,
K: 'a,
V: 'a,
type IsNonZeroType = False
type IsNonZeroType = <&'a RMutex<T> as __StableAbi>::IsNonZeroType
type IsNonZeroType = <&'a RRwLock<T> as __StableAbi>::IsNonZeroType
type IsNonZeroType = <&'a RRwLock<T> as __StableAbi>::IsNonZeroType
type IsNonZeroType = <NonNull<T> as __StableAbi>::IsNonZeroType
type IsNonZeroType = <NonNull<T> as __StableAbi>::IsNonZeroType
type IsNonZeroType = <NonNull<T> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
impl<'borr, P, I, EV> StableAbi for DynTrait<'borr, P, I, EV> where
P: GetPointerKind,
P: __StableAbi,
I: __StableAbi,
EV: __StableAbi,
I: InterfaceBound,
VTable_Ref<'borr, P, I>: StableAbi,
impl<'borr, P, I, EV> StableAbi for DynTrait<'borr, P, I, EV> where
P: GetPointerKind,
P: __StableAbi,
I: __StableAbi,
EV: __StableAbi,
I: InterfaceBound,
VTable_Ref<'borr, P, I>: StableAbi,
type IsNonZeroType = False
impl<'lt, P, I, V> StableAbi for RObject<'lt, P, I, V> where
P: GetPointerKind,
P: __StableAbi,
I: __StableAbi,
V: __GetStaticEquivalent_,
V: PrefixStableAbi,
I: InterfaceBound,
impl<'lt, P, I, V> StableAbi for RObject<'lt, P, I, V> where
P: GetPointerKind,
P: __StableAbi,
I: __StableAbi,
V: __GetStaticEquivalent_,
V: PrefixStableAbi,
I: InterfaceBound,
type IsNonZeroType = False
impl<'lt, _ErasedPtr> StableAbi for Action_TO<'lt, _ErasedPtr> where
_ErasedPtr: __GetPointerKind,
_ErasedPtr: __StableAbi,
Action_Backend<'lt, _ErasedPtr>: StableAbi,
impl<'lt, _ErasedPtr> StableAbi for Action_TO<'lt, _ErasedPtr> where
_ErasedPtr: __GetPointerKind,
_ErasedPtr: __StableAbi,
Action_Backend<'lt, _ErasedPtr>: StableAbi,
type IsNonZeroType = <Action_Backend<'lt, _ErasedPtr> as __StableAbi>::IsNonZeroType
impl<'lt, _ErasedPtr> StableAbi for ConstExample_TO<'lt, _ErasedPtr> where
_ErasedPtr: __GetPointerKind,
_ErasedPtr: __StableAbi,
ConstExample_Backend<'lt, _ErasedPtr>: StableAbi,
impl<'lt, _ErasedPtr> StableAbi for ConstExample_TO<'lt, _ErasedPtr> where
_ErasedPtr: __GetPointerKind,
_ErasedPtr: __StableAbi,
ConstExample_Backend<'lt, _ErasedPtr>: StableAbi,
type IsNonZeroType = <ConstExample_Backend<'lt, _ErasedPtr> as __StableAbi>::IsNonZeroType
impl<'lt, _ErasedPtr> StableAbi for Doer_TO<'lt, _ErasedPtr> where
_ErasedPtr: __GetPointerKind,
_ErasedPtr: __StableAbi,
Doer_Backend<'lt, _ErasedPtr>: StableAbi,
impl<'lt, _ErasedPtr> StableAbi for Doer_TO<'lt, _ErasedPtr> where
_ErasedPtr: __GetPointerKind,
_ErasedPtr: __StableAbi,
Doer_Backend<'lt, _ErasedPtr>: StableAbi,
type IsNonZeroType = <Doer_Backend<'lt, _ErasedPtr> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
impl<A, B, C> StableAbi for Tuple3<A, B, C> where
A: __StableAbi,
B: __StableAbi,
C: __StableAbi,
impl<A, B, C> StableAbi for Tuple3<A, B, C> where
A: __StableAbi,
B: __StableAbi,
C: __StableAbi,
type IsNonZeroType = False
impl<A, B, C, D> StableAbi for Tuple4<A, B, C, D> where
A: __StableAbi,
B: __StableAbi,
C: __StableAbi,
D: __StableAbi,
impl<A, B, C, D> StableAbi for Tuple4<A, B, C, D> where
A: __StableAbi,
B: __StableAbi,
C: __StableAbi,
D: __StableAbi,
type IsNonZeroType = False
impl<E, S, I> StableAbi for NonExhaustive<E, S, I> where
E: __GetStaticEquivalent_,
S: __GetStaticEquivalent_,
I: __GetStaticEquivalent_,
NonExhaustiveVtable_Ref<E, S, I>: StableAbi,
E: GetNonExhaustive<S>,
I: InterfaceBound,
<E as GetNonExhaustive<S>>::NonExhaustive: __StableAbi,
impl<E, S, I> StableAbi for NonExhaustive<E, S, I> where
E: __GetStaticEquivalent_,
S: __GetStaticEquivalent_,
I: __GetStaticEquivalent_,
NonExhaustiveVtable_Ref<E, S, I>: StableAbi,
E: GetNonExhaustive<S>,
I: InterfaceBound,
<E as GetNonExhaustive<S>>::NonExhaustive: __StableAbi,
type IsNonZeroType = False
type IsNonZeroType = <DynTrait<'static, RBox<()>, ValIterInterface<u32, u32>> as __StableAbi>::IsNonZeroType
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = <N as __StableAbi>::IsNonZeroType
type IsNonZeroType = True
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
type IsNonZeroType = False
impl<T> StableAbi for RReceiver<T> where
T: __StableAbi,
This is supported on crate feature channels
only.
impl<T> StableAbi for RReceiver<T> where
T: __StableAbi,
channels
only.type IsNonZeroType = False
impl<T> StableAbi for RSender<T> where
T: __StableAbi,
This is supported on crate feature channels
only.
impl<T> StableAbi for RSender<T> where
T: __StableAbi,
channels
only.