pub trait AsyncFd<T: AsRawFd + AsFd + Send + Sync + 'static>:
Send
+ Sync
+ 'static
+ Deref<Target = T> {
// Required methods
fn async_read<R>(
&self,
f: impl FnMut(&T) -> Result<R> + Send,
) -> impl Future<Output = Result<R>> + Send;
fn async_write<R>(
&self,
f: impl FnMut(&T) -> Result<R> + Send,
) -> impl Future<Output = Result<R>> + Send;
}Expand description
Trait for async file descriptor operations.
This trait provides methods for performing async read and write operations on file descriptors.
§Type Parameters
T- The underlying file descriptor type
Required Methods§
Sourcefn async_read<R>(
&self,
f: impl FnMut(&T) -> Result<R> + Send,
) -> impl Future<Output = Result<R>> + Send
fn async_read<R>( &self, f: impl FnMut(&T) -> Result<R> + Send, ) -> impl Future<Output = Result<R>> + Send
Sourcefn async_write<R>(
&self,
f: impl FnMut(&T) -> Result<R> + Send,
) -> impl Future<Output = Result<R>> + Send
fn async_write<R>( &self, f: impl FnMut(&T) -> Result<R> + Send, ) -> impl Future<Output = Result<R>> + Send
Perform an async write operation.
This method executes the provided closure asynchronously, allowing it to perform write operations on the underlying file descriptor.
§Parameters
f- A closure that performs the actual write operation
§Returns
A future that resolves to the result of the write operation.
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.