[][src]Trait abi_stable::abi_stability::stable_abi_trait::SharedStableAbi

pub unsafe trait SharedStableAbi {
type IsNonZeroType: Boolean;
type Kind: TypeKindTrait;
type StaticEquivalent: 'static;

const S_LAYOUT: &'static TypeLayout;
const S_ABI_INFO: &'static AbiInfoWrapper;
}

Represents a type whose layout is stable.

This trait can be derived using ``.

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*

type Kind: TypeKindTrait

The kind of abi stability of this type,there are 2:

  • ValueKind:The layout of this type does not change in minor versions.

  • PrefixKind: A struct which can add fields in minor versions, only usable behind a shared reference, used to implement extensible vtables and modules.

type StaticEquivalent: 'static

A version of the type which does not borrow anything, used to create a UTypeId for doing layout checking.

Loading content...

Associated Constants

const S_LAYOUT: &'static TypeLayout

The layout of the type provided by implementors.

const S_ABI_INFO: &'static AbiInfoWrapper

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

Loading content...

Implementations on Foreign Types

impl<T> SharedStableAbi for PhantomData<T> where
    T: StableAbi
[src]

impl SharedStableAbi for ()[src]

impl SharedStableAbi for Void[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl SharedStableAbi for u8[src]

impl SharedStableAbi for i8[src]

impl SharedStableAbi for u16[src]

impl SharedStableAbi for i16[src]

impl SharedStableAbi for u32[src]

impl SharedStableAbi for i32[src]

impl SharedStableAbi for u64[src]

impl SharedStableAbi for i64[src]

impl SharedStableAbi for usize[src]

impl SharedStableAbi for isize[src]

impl SharedStableAbi for bool[src]

impl SharedStableAbi for AtomicBool[src]

impl SharedStableAbi for AtomicIsize[src]

impl SharedStableAbi for AtomicUsize[src]

impl SharedStableAbi for NonZeroU8[src]

impl SharedStableAbi for NonZeroU16[src]

impl SharedStableAbi for NonZeroU32[src]

impl SharedStableAbi for NonZeroU64[src]

impl SharedStableAbi for NonZeroUsize[src]

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

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

impl<T> SharedStableAbi for ManuallyDrop<T> where
    T: StableAbi
[src]

impl SharedStableAbi 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 SharedStableAbi 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 SharedStableAbi for TypeKind[src]

impl SharedStableAbi for LifetimeIndex[src]

impl SharedStableAbi for RustPrimitive[src]

impl SharedStableAbi for TLData[src]

impl SharedStableAbi for TLDataDiscriminant[src]

impl SharedStableAbi for FormattingMode[src]

impl SharedStableAbi for CallReferentDrop[src]

impl SharedStableAbi for RCmpOrdering[src]

impl SharedStableAbi for AbiInfo[src]

impl SharedStableAbi for AbiInfoWrapper[src]

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

impl SharedStableAbi for FullType[src]

impl SharedStableAbi for GenericParams[src]

impl SharedStableAbi for TLEnumVariant[src]

impl SharedStableAbi for TLField[src]

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

impl SharedStableAbi for TypeLayout[src]

impl SharedStableAbi for TypeInfo[src]

impl SharedStableAbi for SyncSend[src]

impl SharedStableAbi for UnsyncUnsend[src]

impl SharedStableAbi for PTField[src]

impl SharedStableAbi for PTStructLayout[src]

impl SharedStableAbi for RIoError[src]

impl SharedStableAbi for RIoErrorKind[src]

impl SharedStableAbi for RString[src]

impl SharedStableAbi for StaticStr[src]

impl SharedStableAbi for RDuration[src]

impl SharedStableAbi for UTypeId[src]

impl SharedStableAbi for VersionNumber[src]

impl SharedStableAbi for VersionStrings[src]

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

impl<'a, B, O> SharedStableAbi for RCow<'a, B, O> where
    B: BorrowOwned<'a>,
    O: __StableAbi,
    B: __StableAbi,
    <B as SharedStableAbi>::StaticEquivalent: BorrowOwned<'static>, 
[src]

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

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

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

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

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

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

impl<ErasedPtr> SharedStableAbi for HasherTraitObject<ErasedPtr> where
    ErasedPtr: __StableAbi
[src]

impl<M> SharedStableAbi for RBoxError_<M> where
    M: __StableAbi
[src]

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

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

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

type Kind = ValueKind

type IsNonZeroType = False

type StaticEquivalent = ()

it is fine to use () because this type is treated as a primitive anyway.

const S_ABI_INFO: &'static AbiInfoWrapper[src]

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

impl<T> SharedStableAbi for UnsafeIgnoredType<T>[src]

impl<T> SharedStableAbi for ZeroSized<T> where
    T: __StableAbi
[src]

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

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

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

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

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

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

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

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

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

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

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

Loading content...