Channel

Trait Channel 

Source
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§

Source

type TError

Type of the errors raised by the stub.

Defined by the channel implementation.

Required Methods§

Source

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.

Implementors§