pub trait TcpWriteTrait {
    // Required methods
    fn get_log_head(&self) -> &str;
    fn try_send_bytes(&self, bytes: &[u8]) -> Result<()>;

    // Provided methods
    fn send_text(&self, text: &str) { ... }
    fn try_send_text(&self, text: &str) -> Result<()> { ... }
    fn send_json(&self, json: &(impl Serialize + Sync)) { ... }
    fn try_send_json(&self, json: &(impl Serialize + Sync)) -> Result<()> { ... }
    fn send_bytes(&self, bytes: &[u8]) { ... }
}
Expand description

tcp write trait

Required Methods§

source

fn get_log_head(&self) -> &str

get internal log name

source

fn try_send_bytes(&self, bytes: &[u8]) -> Result<()>

try send bytes to TCP

Provided Methods§

source

fn send_text(&self, text: &str)

send text to tcp

source

fn try_send_text(&self, text: &str) -> Result<()>

try send text to TCP

source

fn send_json(&self, json: &(impl Serialize + Sync))

send json to TCP

source

fn try_send_json(&self, json: &(impl Serialize + Sync)) -> Result<()>

try send json to TCP

source

fn send_bytes(&self, bytes: &[u8])

send bytes to TCP

Object Safety§

This trait is not object safe.

Implementors§

source§

impl TcpWriteTrait for TcpClient

support tcp write trait