pub trait Transport {
// Required methods
fn call(&self, name: String, params: Value) -> Result<Value, Error>;
fn cast(&self, name: String, params: Value);
fn context(&self) -> Option<String>;
// Provided method
fn call_bytes(
&self,
name: String,
params: Value,
into: &mut Vec<u8>,
) -> Result<usize, Error> { ... }
}Expand description
What an action can ask of its host.
Implemented twice: once for the real ABI inside a module, and once by
crate::testing for a host on your own machine. It is public so that the
two are visibly the same contract, and so a later phase can add a transport
without changing what an action sees.
Required Methods§
Provided Methods§
Sourcefn call_bytes(
&self,
name: String,
params: Value,
into: &mut Vec<u8>,
) -> Result<usize, Error>
fn call_bytes( &self, name: String, params: Value, into: &mut Vec<u8>, ) -> Result<usize, Error>
Run an action whose reply is a run of bytes, and append them to into.
Answers with how many bytes were appended. The bytes arrive as they
are — no envelope, no text encoding — and a host that refused answers
with a typed error instead, exactly as Transport::call does.
Provided, so a transport written before this method existed still compiles; the provided one refuses every such call.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".