Trait abi_stable::InterfaceType
source · 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 inDynTrait
. -
Unimplemented<_>
: the trait would not be required by, and not be usable inDynTrait
.
§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§
sourcetype Send: Implementability
type Send: Implementability
Changing this to require/unrequire in minor versions, is an abi breaking change.
sourcetype Sync: Implementability
type Sync: Implementability
Changing this to require/unrequire in minor versions, is an abi breaking change.
sourcetype Unpin: Implementability
type Unpin: Implementability
Changing this to require/unrequire in minor versions, is an abi breaking change.
sourcetype Clone: Implementability
type Clone: Implementability
sourcetype Debug: Implementability
type Debug: Implementability
sourcetype Eq: Implementability
type Eq: Implementability
sourcetype Ord: Implementability
type Ord: Implementability
sourcetype Hash: Implementability
type Hash: Implementability
sourcetype FmtWrite: Implementability
type FmtWrite: Implementability
For the std::fmt::Write
trait
sourcetype IoWrite: Implementability
type IoWrite: Implementability
For the std::io::Write
trait
sourcetype IoSeek: Implementability
type IoSeek: Implementability
For the std::io::Seek
trait
sourcetype IoRead: Implementability
type IoRead: Implementability
For the std::io::Read
trait
sourcetype IoBufRead: Implementability
type IoBufRead: Implementability
For the std::io::BufRead
trait
sourcetype Error: Implementability
type Error: Implementability
For the std::error::Error
trait