pub trait InterfaceType: Sized {
Show 22 associated items type Send: Implementability; type Sync: Implementability; type Unpin: Implementability; type Clone: Implementability; type Default: Implementability; type Display: Implementability; type Debug: Implementability; type Serialize: Implementability; type Eq: Implementability; type PartialEq: Implementability; type Ord: Implementability; type PartialOrd: Implementability; type Hash: Implementability; type Deserialize: Implementability; type Iterator: Implementability; type DoubleEndedIterator: Implementability; type FmtWrite: Implementability; type IoWrite: Implementability; type IoSeek: Implementability; type IoRead: Implementability; type IoBufRead: Implementability; type Error: Implementability;
}
Expand description

Defines the usable/required traits when creating a DynTrait<Pointer<()>, ThisInterfaceType>.

This trait can only be implemented using the #[derive(StableAbi)] derive with the #[sabi(impl_InterfaceType(...))] helper attribute, defaulting associated types to Unimplemented<_>.

The value of every associated type can be:

  • Implemented<_>: the trait would be required by, and be usable in DynTrait.

  • Unimplemented<_>: the trait would not be required by, and not be usable in DynTrait.

Example


use abi_stable::{erased_types::InterfaceType, type_level::bools::*, StableAbi};

#[repr(C)]
#[derive(StableAbi)]
#[sabi(impl_InterfaceType(Clone, Debug))]
pub struct FooInterface;

/*
The `#[sabi(impl_InterfaceType(Clone, Debug))]` helper attribute
(as part of #[derive(StableAbi)]) above is roughly equivalent to this impl:

impl InterfaceType for FooInterface {
    type Clone = Implemented<trait_marker::Clone>;

    type Debug = Implemented<trait_marker::Debug>;

    /////////////////////////////////////
    //// defaulted associated types
    /////////////////////////////////////

    // Changing this to require/unrequire in minor versions, is an abi breaking change.
    // type Send = Unimplemented<trait_marker::Send>;

    // Changing this to require/unrequire in minor versions, is an abi breaking change.
    // type Sync = Unimplemented<trait_marker::Sync>;

    // Changing this to require/unrequire in minor versions, is an abi breaking change.
    // type Unpin = Unimplemented<trait_marker::Unpin>;

    // type Iterator = Unimplemented<trait_marker::Iterator>;

    // type DoubleEndedIterator = Unimplemented<trait_marker::DoubleEndedIterator>;

    // type Default = Unimplemented<trait_marker::Default>;

    // type Display = Unimplemented<trait_marker::Display>;

    // type Serialize = Unimplemented<trait_marker::Serialize>;

    // type Eq = Unimplemented<trait_marker::Eq>;

    // type PartialEq = Unimplemented<trait_marker::PartialEq>;

    // type Ord = Unimplemented<trait_marker::Ord>;

    // type PartialOrd = Unimplemented<trait_marker::PartialOrd>;

    // type Hash = Unimplemented<trait_marker::Hash>;

    // type Deserialize = Unimplemented<trait_marker::Deserialize>;

    // type FmtWrite = Unimplemented<trait_marker::FmtWrite>;

    // type IoWrite = Unimplemented<trait_marker::IoWrite>;

    // type IoSeek = Unimplemented<trait_marker::IoSeek>;

    // type IoRead = Unimplemented<trait_marker::IoRead>;

    // type IoBufRead = Unimplemented<trait_marker::IoBufRead>;

    // type Error = Unimplemented<trait_marker::Error>;
}
*/


Required Associated Types§

source

type Send: Implementability

Changing this to require/unrequire in minor versions, is an abi breaking change.

source

type Sync: Implementability

Changing this to require/unrequire in minor versions, is an abi breaking change.

source

type Unpin: Implementability

Changing this to require/unrequire in minor versions, is an abi breaking change.

source

type Clone: Implementability

source

type Default: Implementability

source

type Display: Implementability

source

type Debug: Implementability

source

type Serialize: Implementability

source

type Eq: Implementability

source

type PartialEq: Implementability

source

type Ord: Implementability

source

type PartialOrd: Implementability

source

type Hash: Implementability

source

type Deserialize: Implementability

source

type Iterator: Implementability

source

type DoubleEndedIterator: Implementability

source

type FmtWrite: Implementability

For the std::fmt::Write trait

source

type IoWrite: Implementability

For the std::io::Write trait

source

type IoSeek: Implementability

For the std::io::Seek trait

source

type IoRead: Implementability

For the std::io::Read trait

source

type IoBufRead: Implementability

For the std::io::BufRead trait

source

type Error: Implementability

For the std::error::Error trait

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl InterfaceType for ()

Implementors§

source§

impl InterfaceType for ExtraChecks_Interface

source§

impl InterfaceType for TypeChecker_Interface

source§

impl InterfaceType for ValidTag_Interface

source§

impl InterfaceType for Action_Interface

source§

impl InterfaceType for ConstExample_Interface

source§

impl InterfaceType for Doer_Interface

source§

impl InterfaceType for CloneEqInterface

source§

impl InterfaceType for CloneInterface

source§

impl InterfaceType for DebugDefEqInterface

source§

impl InterfaceType for DebugDisplayInterface

source§

impl InterfaceType for DefaultInterface

source§

impl InterfaceType for FmtWriteInterface

source§

impl InterfaceType for IoWriteInterface

source§

impl InterfaceType for PartialEqInterface

source§

impl InterfaceType for UnpinInterface

source§

impl<K, V> InterfaceType for MutIterInterface<K, V>

source§

impl<K, V> InterfaceType for RefIterInterface<K, V>

source§

impl<K, V> InterfaceType for ValIterInterface<K, V>

source§

impl<T> InterfaceType for DEIteratorCloneInterface<T>

source§

impl<T> InterfaceType for DEIteratorInterface<T>

source§

impl<T> InterfaceType for IteratorInterface<T>