pub trait Socket:
Send
+ Sync
+ Sized
+ Unpin {
// Required methods
fn connect(
socket_path: &Path,
) -> impl Future<Output = Result<Self, Error>> + Send;
fn write_line(
&mut self,
line: String,
) -> impl Future<Output = Result<(), Error>> + Send;
fn read_line(
&mut self,
) -> impl Future<Output = Result<Option<String>, Error>> + Send;
}Expand description
The Socket trait is a basic abstraction over an underlying asynchronous Unix socket connection used by this crate to connect to fcnetd. This allows for different async I/O implementations to be used interchangeably by implementing this trait.
Required Methods§
fn connect( socket_path: &Path, ) -> impl Future<Output = Result<Self, Error>> + Send
fn write_line( &mut self, line: String, ) -> impl Future<Output = Result<(), Error>> + Send
fn read_line( &mut self, ) -> impl Future<Output = Result<Option<String>, Error>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Socket for SmolSocket
Available on crate feature
smol-socket only.impl Socket for TokioSocket
Available on crate feature
tokio-socket only.