pub trait ThreadableSocket<SendType, ReceiveType>: Sized {
// Required methods
async fn my_connect(addr: Address) -> Result<Self, ()>;
async fn my_send(&mut self, data: TextOrT<Vec<u8>>);
async fn my_read(&mut self) -> Result<TextOrT<Vec<u8>>, ()>;
async fn my_close(self);
}
Expand description
Represents a type that is compatible with ThreadedSocket
Required Methods§
Sourceasync fn my_connect(addr: Address) -> Result<Self, ()>
async fn my_connect(addr: Address) -> Result<Self, ()>
Try to connect to the address
Do not do any retries, fail as soon as possible
Sourceasync fn my_send(&mut self, data: TextOrT<Vec<u8>>)
async fn my_send(&mut self, data: TextOrT<Vec<u8>>)
Send the data to the socket
If this is impossible, simply drop the data
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.