Trait dfhack_proto::Channel

source ·
pub trait Channel {
    type TError;

    // Required method
    fn request<TRequest: Message, TReply: Message>(
        &mut self,
        plugin: String,
        name: String,
        request: TRequest
    ) -> Result<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: Message, TReply: Message>( &mut self, plugin: String, name: String, request: TRequest ) -> Result<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.

Implementors§