pub unsafe trait ExternalArgs {
const FINGERPRINT: MethodFingerprint;
const METADATA: &[u8];
}Expand description
Marker trait for external arguments when calling methods.
§Safety
Struct that implements this trait must be #[repr(C)] and valid ExternalArgs for the contract
method with Self::FINGERPRINT and Self::METADATA, since executors read it according to
that metadata and some of them trust it without checking (like the native executor).
A call can leave contents behind in outputs that are not valid values of their types, even when
it succeeds, and it only initializes the return value. Hence outputs must point to memory whose
contents are not accessed afterward as values of their types without being parsed first, unless
every bit pattern is a valid value. Memory from OutputArg::as_raw_output() is such memory
while it stays exclusively borrowed for the lifetime of the struct. The return value must not
be accessed as a value of its type without being parsed either.
Do not implement this trait explicitly! Implementation is automatically generated by the macro which generates contract implementation.
Required Associated Constants§
Sourceconst FINGERPRINT: MethodFingerprint
const FINGERPRINT: MethodFingerprint
Fingerprint of the method being called
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".