Trait RPCSink

Source
pub trait RPCSink {
    // Required methods
    fn send_message(
        &mut self,
        message: JSONRPCMessage,
    ) -> impl Future<Output = Result<()>> + Send;
    fn send_notification<T: Serialize + Send>(
        &mut self,
        method: &str,
        notification: T,
    ) -> impl Future<Output = Result<()>> + Send;
    fn send_response<T: Serialize + Send>(
        &mut self,
        request_id: RequestId,
        response: T,
    ) -> impl Future<Output = Result<()>> + Send;
    fn request<T: Serialize + Send, R: DeserializeOwned + Send>(
        &mut self,
        request_id: RequestId,
        method: &str,
        request: T,
    ) -> impl Future<Output = Result<Result<R, JSONRPCError>>> + Send;
}

Required Methods§

Source

fn send_message( &mut self, message: JSONRPCMessage, ) -> impl Future<Output = Result<()>> + Send

Source

fn send_notification<T: Serialize + Send>( &mut self, method: &str, notification: T, ) -> impl Future<Output = Result<()>> + Send

Send a notification to the peer.

Source

fn send_response<T: Serialize + Send>( &mut self, request_id: RequestId, response: T, ) -> impl Future<Output = Result<()>> + Send

Send a response to the peer.

Source

fn request<T: Serialize + Send, R: DeserializeOwned + Send>( &mut self, request_id: RequestId, method: &str, request: T, ) -> impl Future<Output = Result<Result<R, JSONRPCError>>> + Send

Send a request to the peer and wait for a response.

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§