Trait Contract

Source
pub trait Contract: IoType {
    type Slot: IoType;
    type Tmp: IoType;

    const MAIN_CONTRACT_METADATA: &[u8];

    // Required method
    fn code() -> impl Deref<Target = VariableBytes<MAX_CODE_SIZE>>;
}
Expand description

A trait that indicates the struct is a contact.

Do not implement this trait explicitly! Implementation is automatically generated by the macro which generates contract implementation. This trait is required, but not sufficient for proper contract implementation, use #[contract] attribute macro instead.

Required Associated Constants§

Source

const MAIN_CONTRACT_METADATA: &[u8]

Main contract metadata, see ContractMetadataKind for encoding details.

More metadata can be contributed by trait implementations.

Required Associated Types§

Source

type Slot: IoType

Slot type used by this contract

Source

type Tmp: IoType

Tmp type used by this contract

Required Methods§

Source

fn code() -> impl Deref<Target = VariableBytes<MAX_CODE_SIZE>>

Something that can be used as “code” in native execution environment and primarily used for testing.

This is NOT the code compiled for guest architecture!

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§