Skip to main content

TryWrite

Trait TryWrite 

pub trait TryWrite:
    Send
    + Sync
    + 'static {
    // Required methods
    fn try_write(&self, buf: &[u8]) -> Result<usize>;
    fn writable(&self) -> impl Future<Output = Result<()>> + Send;

    // Provided method
    fn unix_fd(&self) -> Option<RawFd> { ... }
}
Expand description

The write side of a Socket. Shard threads write without a runtime.

Required Methods§

fn try_write(&self, buf: &[u8]) -> Result<usize>

Writes what the socket takes now; WouldBlock when it takes nothing.

fn writable(&self) -> impl Future<Output = Result<()>> + Send

Provided Methods§

fn unix_fd(&self) -> Option<RawFd>

The socket’s descriptor if it is a Unix socket, which can carry descriptors (same-host shared memory).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl TryWrite for OwnedWriteHalf

§

fn try_write(&self, buf: &[u8]) -> Result<usize>

§

fn writable(&self) -> impl Future<Output = Result<()>> + Send

§

impl TryWrite for OwnedWriteHalf

§

fn try_write(&self, buf: &[u8]) -> Result<usize>

§

fn writable(&self) -> impl Future<Output = Result<()>> + Send

§

fn unix_fd(&self) -> Option<RawFd>

Implementors§