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§
Provided Methods§
Sourcefn 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 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
.
Sourcefn 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 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.
Sourcefn can_pass_unix_fd(&self) -> bool
fn can_pass_unix_fd(&self) -> bool
Supports passing file descriptors.
Default implementation returns false
.
Sourcefn 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,
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>
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,
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,
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,
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
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,
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,
Implementations on Foreign Types§
Source§impl WriteHalf for Box<dyn WriteHalf>
impl WriteHalf for Box<dyn WriteHalf>
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 close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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,
Source§impl WriteHalf for Arc<Async<TcpStream>>
impl WriteHalf for Arc<Async<TcpStream>>
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,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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 Arc<Async<UnixStream>>
impl WriteHalf for Arc<Async<UnixStream>>
Source§fn can_pass_unix_fd(&self) -> bool
fn can_pass_unix_fd(&self) -> bool
Supports passing file descriptors.