Skip to main content

ConnectionTransport

Trait ConnectionTransport 

Source
pub trait ConnectionTransport: Send + Sync {
    // Required methods
    fn send_frame(&mut self, cx: &mut Cx, frame: ServerFrame) -> Result<()>;
    fn recv_frame(
        &mut self,
        cx: &mut Cx,
        timeout: Option<Duration>,
    ) -> Result<Option<ServerFrame>>;
    fn close(&mut self, cx: &mut Cx) -> Result<()>;
    fn as_any(&self) -> &dyn Any;

    // Provided method
    fn serve_connection(
        &mut self,
        _runtime: &Arc<ServerRuntime>,
        _site: &Arc<dyn EvalSite>,
    ) -> Result<()> { ... }
}
Expand description

One open connection over which server frames are sent and received.

Required Methods§

Source

fn send_frame(&mut self, cx: &mut Cx, frame: ServerFrame) -> Result<()>

Sends one frame over the connection.

Source

fn recv_frame( &mut self, cx: &mut Cx, timeout: Option<Duration>, ) -> Result<Option<ServerFrame>>

Receives one frame, returning None on timeout or end of stream.

Source

fn close(&mut self, cx: &mut Cx) -> Result<()>

Closes the connection.

Source

fn as_any(&self) -> &dyn Any

Returns this connection as Any for downcasting.

Provided Methods§

Source

fn serve_connection( &mut self, _runtime: &Arc<ServerRuntime>, _site: &Arc<dyn EvalSite>, ) -> Result<()>

Serves the connection server-side against site.

The default implementation errors; transports that support server-side serving override it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§