Skip to main content

Transport

Trait Transport 

Source
pub trait Transport:
    Send
    + Sync
    + Debug {
    // Required methods
    fn next_id(&self) -> String;
    fn call<'a>(
        &'a self,
        id: String,
        method: &'a str,
        params: Value,
        sink: Option<NotifySink>,
        cancel_on_drop: bool,
        clock: &'a Arc<dyn Clock>,
    ) -> BoxFuture<'a, Result<Value, CallError>>;
    fn initialize<'a>(
        &'a self,
        clock: &'a Arc<dyn Clock>,
    ) -> BoxFuture<'a, Result<Value, CallError>>;

    // Provided methods
    fn note_timeout(&self) { ... }
    fn note_answer(&self) { ... }
}
Expand description

A channel to one plugin.

Required Methods§

Source

fn next_id(&self) -> String

A fresh request id.

Source

fn call<'a>( &'a self, id: String, method: &'a str, params: Value, sink: Option<NotifySink>, cancel_on_drop: bool, clock: &'a Arc<dyn Clock>, ) -> BoxFuture<'a, Result<Value, CallError>>

Send request id and wait for the response. Notifications carrying request_id == id are passed to sink. Dropping the future abandons the request (and cancels it when cancel_on_drop is set).

Source

fn initialize<'a>( &'a self, clock: &'a Arc<dyn Clock>, ) -> BoxFuture<'a, Result<Value, CallError>>

Run the initialize handshake (starting the plugin if needed) and return its result.

Provided Methods§

Source

fn note_timeout(&self)

A request was abandoned after its timeout. Transports supervising a process use this to restart a plugin that stopped answering. Default: no-op.

Source

fn note_answer(&self)

A request completed (successfully or with a plugin error). Default: no-op.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§