Trait zbus::connection::socket::WriteHalf

source ·
pub trait WriteHalf: Debug + Send + Sync + 'static {
    // Required method
    fn close<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn send_message<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        msg: &'life1 Message
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn sendmsg<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        _buffer: &'life1 [u8],
        _fds: &'life2 [BorrowedFd<'life3>]
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn can_pass_unix_fd(&self) -> bool { ... }
    fn peer_credentials<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<ConnectionCredentials>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

The write half of a socket.

See Socket for more details.

Required Methods§

source

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the socket.

After this call, it is valid for all reading and writing operations to fail.

Provided Methods§

source

fn send_message<'life0, 'life1, 'async_trait>( &'life0 mut self, msg: &'life1 Message ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message on the socket.

This is the higher-level method to send a full D-Bus message.

The default implementation uses sendmsg to send the message. Implementers should override either this or sendmsg.

source

fn sendmsg<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, _buffer: &'life1 [u8], _fds: &'life2 [BorrowedFd<'life3>] ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Attempt to send a message on the socket

On success, return the number of bytes written. There may be a partial write, in which case the caller is responsible of sending the remaining data by calling this method again until everything is written or it returns an error of kind WouldBlock.

If at least one byte has been written, then all the provided file descriptors will have been sent as well, and should not be provided again in subsequent calls.

If the underlying transport does not support transmitting file descriptors, this will return Err(ErrorKind::InvalidInput).

The default implementation simply panics. Implementers must override either send_message or this method.

source

fn can_pass_unix_fd(&self) -> bool

Supports passing file descriptors.

Default implementation returns false.

source

fn peer_credentials<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<ConnectionCredentials>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the peer credentials.

Trait Implementations§

source§

impl WriteHalf for Box<dyn WriteHalf>

source§

fn send_message<'life0, 'life1, 'async_trait>( &'life0 mut self, msg: &'life1 Message ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message on the socket. Read more
source§

fn sendmsg<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, buffer: &'life1 [u8], fds: &'life2 [BorrowedFd<'life3>] ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Attempt to send a message on the socket Read more
source§

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the socket. Read more
source§

fn can_pass_unix_fd(&self) -> bool

Supports passing file descriptors. Read more
source§

fn peer_credentials<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<ConnectionCredentials>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the peer credentials.

Implementations on Foreign Types§

source§

impl WriteHalf for Box<dyn WriteHalf>

source§

fn send_message<'life0, 'life1, 'async_trait>( &'life0 mut self, msg: &'life1 Message ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn sendmsg<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, buffer: &'life1 [u8], fds: &'life2 [BorrowedFd<'life3>] ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn can_pass_unix_fd(&self) -> bool

source§

fn peer_credentials<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<ConnectionCredentials>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl WriteHalf for WriteHalf

source§

fn sendmsg<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, buf: &'life1 [u8], fds: &'life2 [BorrowedFd<'life3>] ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl WriteHalf for OwnedWriteHalf

source§

fn sendmsg<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, buf: &'life1 [u8], fds: &'life2 [BorrowedFd<'life3>] ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl WriteHalf for OwnedWriteHalf

source§

fn can_pass_unix_fd(&self) -> bool

Supports passing file descriptors.

source§

fn sendmsg<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, buffer: &'life1 [u8], fds: &'life2 [BorrowedFd<'life3>] ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

source§

fn close<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn peer_credentials<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<ConnectionCredentials>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§