[][src]Trait abi_stable::InterfaceType

pub trait InterfaceType: Sized {
    type Send;
    type Sync;
    type Clone;
    type Default;
    type Display;
    type Debug;
    type Serialize;
    type Eq;
    type PartialEq;
    type Ord;
    type PartialOrd;
    type Hash;
    type Deserialize;
    type Iterator;
    type DoubleEndedIterator;
    type FmtWrite;
    type IoWrite;
    type IoSeek;
    type IoRead;
    type IoBufRead;
    type Error;
}

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

This trait can only be implemented using the #[derive(StableAbi)] and the impl_InterfaceType macro, giving a default value to each associated type, so that adding associated types is not a breaking change.

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::{
    StableAbi,
    erased_types::InterfaceType,
    type_level::bools::*,
};

#[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>;

    // 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>;
}
*/


Associated Types

type Send[src]

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

type Sync[src]

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

type Clone[src]

type Default[src]

type Display[src]

type Debug[src]

type Serialize[src]

type Eq[src]

type PartialEq[src]

type Ord[src]

type PartialOrd[src]

type Hash[src]

type Deserialize[src]

type Iterator[src]

type DoubleEndedIterator[src]

type FmtWrite[src]

type IoWrite[src]

type IoSeek[src]

type IoRead[src]

type IoBufRead[src]

type Error[src]

Loading content...

Implementations on Foreign Types

impl InterfaceType for ()[src]

Loading content...

Implementors

impl InterfaceType for ExtraChecks_Interface[src]

impl InterfaceType for TypeChecker_Interface[src]

impl InterfaceType for CloneEqInterface[src]

impl InterfaceType for CloneInterface[src]

impl InterfaceType for DebugDisplayInterface[src]

impl InterfaceType for DefaultInterface[src]

impl InterfaceType for FmtWriteInterface[src]

impl InterfaceType for IoWriteInterface[src]

impl InterfaceType for PartialEqInterface[src]

impl InterfaceType for ValidTag_Interface[src]

impl InterfaceType for ConstExample_Interface[src]

impl<K, V> InterfaceType for MutIterInterface<K, V>[src]

impl<K, V> InterfaceType for RefIterInterface<K, V>[src]

impl<K, V> InterfaceType for ValIterInterface<K, V>[src]

impl<T> InterfaceType for DEIteratorInterface<T>[src]

impl<T> InterfaceType for IteratorInterface<T>[src]

Loading content...