pub struct Tube {
socket: ScmSocket<UnixSeqpacket>,
}
Expand description
Bidirectional tube that support both send and recv.
Fields§
§socket: ScmSocket<UnixSeqpacket>
Implementations§
source§impl Tube
impl Tube
sourcepub fn split_to_send_recv(self) -> Result<(SendTube, RecvTube)>
pub fn split_to_send_recv(self) -> Result<(SendTube, RecvTube)>
Given a Tube end, creates two new ends, one each for sending and receiving.
sourcepub fn directional_pair() -> Result<(SendTube, RecvTube)>
pub fn directional_pair() -> Result<(SendTube, RecvTube)>
Creates a Send/Recv pair of Tubes.
pub fn try_clone_send_tube(&self) -> Result<SendTube>
source§impl Tube
impl Tube
sourcepub fn pair() -> Result<(Tube, Tube)>
pub fn pair() -> Result<(Tube, Tube)>
Create a pair of connected tubes. Request is sent in one direction while response is in the other direction.
sourcepub fn try_clone(&self) -> Result<Self>
👎Deprecated
pub fn try_clone(&self) -> Result<Self>
DO NOT USE this method directly as it will become private soon (b/221484449). Use a directional Tube pair instead.
sourcepub fn send<T: Serialize>(&self, msg: &T) -> Result<()>
pub fn send<T: Serialize>(&self, msg: &T) -> Result<()>
Sends a message via a Tube.
The number of file descriptors that this method can send is limited to TUBE_MAX_FDS
.
If you want to send more descriptors, use send_with_max_fds
instead.
sourcepub fn send_with_max_fds<T: Serialize>(
&self,
msg: &T,
max_fds: usize
) -> Result<()>
pub fn send_with_max_fds<T: Serialize>( &self, msg: &T, max_fds: usize ) -> Result<()>
Sends a message with at most max_fds
file descriptors via a Tube.
Note that max_fds
must not exceed SCM_SOCKET_MAX_FD_COUNT
(= 253).
sourcepub fn recv<T: DeserializeOwned>(&self) -> Result<T>
pub fn recv<T: DeserializeOwned>(&self) -> Result<T>
Recieves a message from a Tube.
If the sender sent file descriptors more than TUBE_MAX_FDS with send_with_max_fds
, use
recv_with_max_fds
instead.
sourcepub fn recv_with_max_fds<T: DeserializeOwned>(
&self,
max_fds: usize
) -> Result<T>
pub fn recv_with_max_fds<T: DeserializeOwned>( &self, max_fds: usize ) -> Result<T>
Recieves a message with at most max_fds
file descriptors from a Tube.