pub trait Channel {
type TError;
// Required method
fn request<TRequest: MessageFull, TReply: MessageFull>(
&mut self,
plugin: String,
name: String,
request: TRequest,
) -> Result<Reply<TReply>, Self::TError>;
}Expand description
The Channel is the low-level exchange implementation.
It is in charge to serialize/deserialize messages, and exchange them with Dwarf Fortress. It is not meant to be used as is, but to be passed to It is analoguous to the gRPC channel.
Required Associated Types§
Required Methods§
Sourcefn request<TRequest: MessageFull, TReply: MessageFull>(
&mut self,
plugin: String,
name: String,
request: TRequest,
) -> Result<Reply<TReply>, Self::TError>
fn request<TRequest: MessageFull, TReply: MessageFull>( &mut self, plugin: String, name: String, request: TRequest, ) -> Result<Reply<TReply>, Self::TError>
Send a request to DFHack, and return its reply.
§Errors
The error type is defined by the channel implementation
§Arguments
plugin- Name of the plugin implementing the request. Example: “RemoteFortressReader”. Empty for core messages.name- Name of the method. Example: “GetDFVersion”request- Input of the method.
§Returns
A protobuf result type.
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.