pub struct Tube {
socket: StreamChannel,
}
Expand description
Bidirectional tube that support both send and recv.
Fields§
§socket: StreamChannel
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 new(socket: StreamChannel) -> Result<Tube>
pub fn new(socket: StreamChannel) -> Result<Tube>
Create a new Tube
from a StreamChannel
.
The StreamChannel must use FramingMode::Message (meaning, must use a SOCK_SEQPACKET as the
underlying socket type), otherwise, this method returns an error.
sourcepub fn new_from_unix_seqpacket(sock: UnixSeqpacket) -> Tube
pub fn new_from_unix_seqpacket(sock: UnixSeqpacket) -> Tube
Create a new Tube
from a UnixSeqpacket. The StreamChannel is implicitly constructed to
have the right FramingMode by being constructed from a UnixSeqpacket.
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.
pub fn send<T: Serialize>(&self, msg: &T) -> Result<()>
pub fn recv<T: DeserializeOwned>(&self) -> Result<T>
pub fn set_send_timeout(&self, timeout: Option<Duration>) -> Result<()>
pub fn set_recv_timeout(&self, timeout: Option<Duration>) -> Result<()>
fn send_proto<M: Message>(&self, msg: &M) -> Result<()>
fn recv_proto<M: Message>(&self) -> Result<M>
Trait Implementations§
source§impl AsRawDescriptor for Tube
impl AsRawDescriptor for Tube
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
Returns the underlying raw descriptor. Read more
source§impl<'de> Deserialize<'de> for Tube
impl<'de> Deserialize<'de> for Tube
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl ReadNotifier for Tube
impl ReadNotifier for Tube
source§fn get_read_notifier(&self) -> &dyn AsRawDescriptor
fn get_read_notifier(&self) -> &dyn AsRawDescriptor
Gets a descriptor that can be used in EventContext to wait for events to be available (e.g.
to avoid receive_events blocking).