pub unsafe 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.
§Safety
The native executor relies on implementations instead of checking them:
Self::MAIN_CONTRACT_METADATAmust describe this contract- each entry of
Self::NATIVE_EXECUTOR_METHODSmust contain the fingerprint and metadata of a method of this contract, and an FFI function that accepts arguments of that exact method and handles them the way the FFI functions generated by#[contract]do
Required Associated Constants§
Sourceconst MAIN_CONTRACT_METADATA: &[u8]
const MAIN_CONTRACT_METADATA: &[u8]
Main contract metadata, see ContractMetadataKind for encoding details.
More metadata can be contributed by trait implementations.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".