[][src]Trait abi_stable::StableAbi

pub unsafe trait StableAbi {
    type IsNonZeroType: Boolean;

    const LAYOUT: &'static TypeLayout;
    const ABI_INFO: &'static AbiInfoWrapper;
}

Represents a type whose layout is stable.

This trait can be derived using #[derive(StableAbi)].

Safety

The layout of types implementing this trait must be stable across minor versions,

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

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 AbiStable.

An alternative for types where IsNonZeroType=False,you can use abi_stable::ROption.

Non-exhaustive list of std types that are NonZero:

  • &T (any T).

  • &mut T (any T).

  • extern fn() : Any combination of StableAbi parameter/return types.

  • std::ptr::NonNull

  • std::num::NonZero*

Loading content...

Associated Constants

const LAYOUT: &'static TypeLayout

The layout of the type provided by implementors.

const ABI_INFO: &'static AbiInfoWrapper

The layout of the type,derived from Self::LAYOUT and associated types.

Loading content...

Implementations on Foreign Types

impl<T> StableAbi for PhantomData<T>[src]

impl StableAbi for ()[src]

impl<'a, T> StableAbi for &'a T where
    T: 'a + StableAbi
[src]

impl<'a, T> StableAbi for &'a mut T where
    T: 'a + StableAbi
[src]

impl<T> StableAbi for NonNull<T> where
    T: StableAbi
[src]

impl<T> StableAbi for AtomicPtr<T> where
    T: StableAbi
[src]

impl<T> StableAbi for *const T where
    T: StableAbi
[src]

impl<T> StableAbi for *mut T where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 0] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 1] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 2] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 3] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 4] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 5] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 6] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 7] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 8] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 9] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 10] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 11] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 12] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 13] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 14] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 15] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 16] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 17] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 18] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 19] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 20] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 21] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 22] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 23] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 24] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 25] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 26] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 27] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 28] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 29] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 30] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 31] where
    T: StableAbi
[src]

impl<T> StableAbi for [T; 32] where
    T: StableAbi
[src]

impl<T> StableAbi for Option<T> where
    T: StableAbi<IsNonZeroType = True>, 
[src]

Implementing abi stability for Option is fine if T is a NonZero primitive type.

impl StableAbi for u8[src]

impl StableAbi for i8[src]

impl StableAbi for u16[src]

impl StableAbi for i16[src]

impl StableAbi for u32[src]

impl StableAbi for i32[src]

impl StableAbi for u64[src]

impl StableAbi for i64[src]

impl StableAbi for usize[src]

impl StableAbi for isize[src]

impl StableAbi for bool[src]

impl StableAbi for AtomicBool[src]

impl StableAbi for AtomicIsize[src]

impl StableAbi for AtomicUsize[src]

impl StableAbi for NonZeroU8[src]

impl StableAbi for NonZeroU16[src]

impl StableAbi for NonZeroU32[src]

impl StableAbi for NonZeroU64[src]

impl StableAbi for NonZeroUsize[src]

impl<N> StableAbi for Wrapping<N> where
    N: StableAbi
[src]

impl<P> StableAbi for Pin<P> where
    P: StableAbi
[src]

impl StableAbi for extern "C" fn()[src]

This is the only function type that implements StableAbi so as to make it more obvious that functions involving lifetimes cannot implement this trait directly (because of higher ranked trait bounds).

impl StableAbi for unsafe extern "C" fn()[src]

This is the only function type that implements StableAbi so as to make it more obvious that functions involving lifetimes cannot implement this trait directly (because of higher ranked trait bounds).

Loading content...

Implementors

impl StableAbi for LifetimeIndex[src]

impl StableAbi for RustPrimitive[src]

impl StableAbi for TLData[src]

impl StableAbi for TLDataDiscriminant[src]

impl StableAbi for FormattingMode[src]

impl StableAbi for CallReferentDrop[src]

impl StableAbi for RCmpOrdering[src]

impl StableAbi for AbiInfo[src]

impl StableAbi for AbiInfoWrapper[src]

impl StableAbi for GetAbiInfo where
    extern "C" fn(): __StableAbi
[src]

impl StableAbi for FullType[src]

impl StableAbi for GenericParams[src]

impl StableAbi for TLEnumVariant[src]

impl StableAbi for TLField[src]

impl StableAbi for TLFieldAndType where
    &'static TLField: __StableAbi
[src]

impl StableAbi for TypeLayout[src]

impl StableAbi for TypeInfo[src]

impl StableAbi for ImplFlag[src]

impl StableAbi for RIoError[src]

impl StableAbi for RIoErrorKind[src]

impl StableAbi for RString[src]

impl StableAbi for StaticStr[src]

impl StableAbi for RDuration[src]

impl StableAbi for UTypeId[src]

impl StableAbi for VersionNumber[src]

impl StableAbi for VersionStrings[src]

impl<'a> StableAbi for RStr<'a>[src]

impl<'a, B: ?Sized, Owned, Borrowed> StableAbi for RCow<'a, B> where
    B: BorrowOwned<'a, RBorrowed = Borrowed, ROwned = Owned>,
    Owned: StableAbi,
    Borrowed: StableAbi + Copy + 'a, 
[src]

impl<'a, T> StableAbi for RSlice<'a, T> where
    T: __StableAbi,
    T: 'a, 
[src]

impl<'a, T> StableAbi for RSliceMut<'a, T> where
    T: __StableAbi,
    T: 'a, 
[src]

impl<A> StableAbi for Tuple1<A> where
    A: __StableAbi
[src]

impl<A, B> StableAbi for Tuple2<A, B> where
    A: __StableAbi,
    B: __StableAbi
[src]

impl<A, B, C> StableAbi for Tuple3<A, B, C> where
    C: __StableAbi,
    A: __StableAbi,
    B: __StableAbi
[src]

impl<A, B, C, D> StableAbi for Tuple4<A, B, C, D> where
    D: __StableAbi,
    C: __StableAbi,
    B: __StableAbi,
    A: __StableAbi
[src]

impl<M> StableAbi for RBoxError_<M>[src]

impl<P> StableAbi for HasherTraitObject<P> where
    P: __StableAbi
[src]

impl<P> StableAbi for VirtualWrapper<P> where
    P: __StableAbi
[src]

impl<T> StableAbi for ROption<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for UnsafeOpaqueField<T>[src]

impl<T> StableAbi for CmpIgnored<T> where
    T: __StableAbi,
    T: __StableAbi
[src]

impl<T> StableAbi for OpaqueType<T>[src]

impl<T> StableAbi for RRange<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for RRangeFrom<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for RRangeInclusive<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for RRangeTo<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for RRangeToInclusive<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for RArc<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for RBox<T> where
    T: __StableAbi
[src]

impl<T> StableAbi for RVec<T> where
    T: __StableAbi
[src]

impl<T, E> StableAbi for RResult<T, E> where
    T: __StableAbi,
    E: __StableAbi
[src]

impl<T, P> StableAbi for VTable<T, P> where
    T: __StableAbi,
    P: __StableAbi
[src]

impl<T: 'static> StableAbi for WithLayout<T> where
    T: __StableAbi
[src]

impl<T: 'static> StableAbi for StaticSlice<T> where
    T: __StableAbi
[src]

Loading content...