pub trait ConnectedProtocol {
    type Protocol: Proxy;
    type ConnectError: Display;
    type Message;
    type SendError: Display;

    // Required methods
    fn get_protocol<'a>(
        &'a mut self
    ) -> BoxFuture<'a, Result<Self::Protocol, Self::ConnectError>>;
    fn send_message<'a>(
        &'a mut self,
        protocol: &'a Self::Protocol,
        msg: Self::Message
    ) -> BoxFuture<'a, Result<(), Self::SendError>>;
}
Expand description

A trait for implementing connecting to and sending messages to a FIDL protocol.

Required Associated Types§

source

type Protocol: Proxy

The protocol that will be connected to.

source

type ConnectError: Display

An error type returned for connection failures.

source

type Message

The message type that will be forwarded to the Protocol.

source

type SendError: Display

An error type returned for message send failures.

Required Methods§

source

fn get_protocol<'a>( &'a mut self ) -> BoxFuture<'a, Result<Self::Protocol, Self::ConnectError>>

Connects to the protocol represented by Protocol.

If this is a two-step process as in the case of the ServiceHub pattern, both steps should be performed in this function.

source

fn send_message<'a>( &'a mut self, protocol: &'a Self::Protocol, msg: Self::Message ) -> BoxFuture<'a, Result<(), Self::SendError>>

Sends a message to the underlying Protocol.

The protocol object should be assumed to be connected.

Implementors§