ConnectionBindings

Trait ConnectionBindings 

Source
pub trait ConnectionBindings: 'static {
    type Deserializer: Deserializer;
    type Serializer: Serializer;
    type Reactor: MessageReactor<Inbound = <Self::Deserializer as Deserializer>::Message>;
    type Stream: AsyncRead + AsyncWrite + Unpin + Send + 'static;
}
Expand description

Define the types for a Connection.

A protosocket uses only 1 kind of message per port. This is a constraint to keep types straightforward. If you want multiple message types, you should consider using protocol buffers oneof fields. You would use a wrapper type to hold the oneof and any additional metadata, like a request ID or trace id.

Required Associated Types§

Source

type Deserializer: Deserializer

The deserializer for this connection.

Source

type Serializer: Serializer

The serializer for this connection.

Source

type Reactor: MessageReactor<Inbound = <Self::Deserializer as Deserializer>::Message>

The message reactor for this connection.

Source

type Stream: AsyncRead + AsyncWrite + Unpin + Send + 'static

Bidirectional Stream type to use for this connection. Like tokio::net::TcpStream.

Implementors§