pub trait ContractCaller {
// Required method
fn call_raw(
&self,
script_hash: &NeoByteString,
method: &str,
args: &[NeoValue],
call_flags: &NeoInteger,
) -> Result<NeoValue, NeoError>;
// Provided method
fn call_typed<T>(
&self,
script_hash: &NeoByteString,
method: &str,
args: &[NeoValue],
call_flags: &NeoInteger,
) -> Result<T, NeoError>
where T: FromNeoValue { ... }
}Expand description
Trait for static-method-style cross-contract calls. The L9
call_typed<T> helper invokes a remote contract’s method
and decodes the return value into a typed Rust value via
the FromNeoValue trait. The default implementation
delegates to the existing NeoVMSyscall::contract_call
path; contract code that wants a custom transport (e.g.
off-chain simulation) can override call_raw and route
the value through call_typed.
L9 status: shipped as a trait + impl. The default
call_raw calls NeoVMSyscall::contract_call, which on
the wasm32 path panics with a clear “see L6 design” message
(B4 fix). On the host path it returns NeoValue::Null
(existing B4 behaviour). The L6 cross-call executor will
upgrade the wasm32 path to a real implementation; call_typed
needs no changes for that.
Required Methods§
Sourcefn call_raw(
&self,
script_hash: &NeoByteString,
method: &str,
args: &[NeoValue],
call_flags: &NeoInteger,
) -> Result<NeoValue, NeoError>
fn call_raw( &self, script_hash: &NeoByteString, method: &str, args: &[NeoValue], call_flags: &NeoInteger, ) -> Result<NeoValue, NeoError>
Invoke a remote contract’s method with the given args
and return the raw NeoValue. The default impl uses
NeoVMSyscall::contract_call.
Provided Methods§
Sourcefn call_typed<T>(
&self,
script_hash: &NeoByteString,
method: &str,
args: &[NeoValue],
call_flags: &NeoInteger,
) -> Result<T, NeoError>where
T: FromNeoValue,
fn call_typed<T>(
&self,
script_hash: &NeoByteString,
method: &str,
args: &[NeoValue],
call_flags: &NeoInteger,
) -> Result<T, NeoError>where
T: FromNeoValue,
Invoke a remote contract’s method and decode the return
value into a typed Rust value via FromNeoValue.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".