Trait WireTx

Source
pub trait WireTx {
    type Error: AsWireTxErrorKind;

    // Required methods
    async fn send<T: Serialize + ?Sized>(
        &self,
        hdr: VarHeader,
        msg: &T,
    ) -> Result<(), Self::Error>;
    async fn send_raw(&self, buf: &[u8]) -> Result<(), Self::Error>;
    async fn send_log_str(
        &self,
        kkind: VarKeyKind,
        s: &str,
    ) -> Result<(), Self::Error>;
    async fn send_log_fmt<'a>(
        &self,
        kkind: VarKeyKind,
        a: Arguments<'a>,
    ) -> Result<(), Self::Error>;
}
Expand description

This trait defines how the server sends frames to the client

Required Associated Types§

Source

type Error: AsWireTxErrorKind

The error type of this connection.

For simple cases, you can use WireTxErrorKind directly. You can also use your own custom type that implements AsWireTxErrorKind.

Required Methods§

Source

async fn send<T: Serialize + ?Sized>( &self, hdr: VarHeader, msg: &T, ) -> Result<(), Self::Error>

Send a single frame to the client, returning when send is complete.

Source

async fn send_raw(&self, buf: &[u8]) -> Result<(), Self::Error>

Send a single frame to the client, without handling serialization

Source

async fn send_log_str( &self, kkind: VarKeyKind, s: &str, ) -> Result<(), Self::Error>

Send a logging message on the LoggingTopic

This message is simpler as it does not do any formatting

Source

async fn send_log_fmt<'a>( &self, kkind: VarKeyKind, a: Arguments<'a>, ) -> Result<(), Self::Error>

Send a logging message on the LoggingTopic

This version formats to the outgoing buffer

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§