AbiExportableImplementation

Trait AbiExportableImplementation 

Source
pub unsafe trait AbiExportableImplementation {
    type AbiInterface: ?Sized + AbiExportable;

    const ABI_ENTRY: unsafe extern "C" fn(AbiProtocol);

    // Required method
    fn new() -> Box<Self::AbiInterface>;
}
Expand description

Trait that is to be implemented for the implementation of a trait whose dyn trait type implements AbiExportable.

If MyExampleTrait is an ABI-exportable trait, and MyExampleImplementation is an implementation of MyExampleTrait, then:

  • The AbiInterface associated type must be dyn MyExampleTrait
  • AbiExportableImplementation must be implemented for MyExampleImplementation

§Safety

The following must be fulfilled:

  • ABI_ENTRY must be a valid function, implementing the AbiProtocol-protocol.
  • AbiInterface must be ‘dyn SomeTrait’, where ‘SomeTrait’ is an exported trait.

Required Associated Constants§

Source

const ABI_ENTRY: unsafe extern "C" fn(AbiProtocol)

An entry point which implements the AbiProtocol protocol

Required Associated Types§

Source

type AbiInterface: ?Sized + AbiExportable

The type ‘dyn SomeTrait’.

Required Methods§

Source

fn new() -> Box<Self::AbiInterface>

A method which must be able to return a default-implementation of dyn SomeTrait. I.e, the returned box is a boxed dyn trait, not ‘Self’ (the actual implementation type).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§