Struct fibers_transport::TcpTransporter [−][src]
An implementation of Transport
that uses TCP as the transport layer.
Methods
impl<E, D> TcpTransporter<E, D> where
E: Encode + Default,
D: Decode + Default,
[src]
impl<E, D> TcpTransporter<E, D> where
E: Encode + Default,
D: Decode + Default,
pub fn connect(
peer: SocketAddr
) -> impl Future<Item = Self, Error = Error>
[src]
pub fn connect(
peer: SocketAddr
) -> impl Future<Item = Self, Error = Error>
Starts connecting to the given peer and
will return a new TcpTransporter
instance if the connect operation is succeeded.
This is equivalent to TcpTransporterBuilder::new().connect(peer)
.
pub fn from_stream(stream: TcpStream) -> Result<Self>
[src]
pub fn from_stream(stream: TcpStream) -> Result<Self>
Makes a new TcpTransporter
instance from the given TcpStream
.
This is equivalent to TcpTransporterBuilder::new().finish(stream)
.
impl<E: Encode, D: Decode> TcpTransporter<E, D>
[src]
impl<E: Encode, D: Decode> TcpTransporter<E, D>
pub fn message_queue_len(&self) -> usize
[src]
pub fn message_queue_len(&self) -> usize
Returns the number of unsent messages in the queue of the instance.
ⓘImportant traits for TcpStreampub fn stream_ref(&self) -> &TcpStream
[src]
pub fn stream_ref(&self) -> &TcpStream
Returns a reference to the TCP stream being used by the instance.
ⓘImportant traits for TcpStreampub fn stream_mut(&mut self) -> &mut TcpStream
[src]
pub fn stream_mut(&mut self) -> &mut TcpStream
Returns a mutable reference to the TCP stream being used by the instance.
ⓘImportant traits for &'a mut Rpub fn decoder_ref(&self) -> &D
[src]
pub fn decoder_ref(&self) -> &D
Returns a reference to the decoder being used by the instance.
ⓘImportant traits for &'a mut Rpub fn decoder_mut(&mut self) -> &mut D
[src]
pub fn decoder_mut(&mut self) -> &mut D
Returns a mutable reference to the decoder being used by the instance.
ⓘImportant traits for &'a mut Rpub fn encoder_ref(&self) -> &E
[src]
pub fn encoder_ref(&self) -> &E
Returns a reference to the encoder being used by the instance.
ⓘImportant traits for &'a mut Rpub fn encoder_mut(&mut self) -> &mut E
[src]
pub fn encoder_mut(&mut self) -> &mut E
Returns a mutable reference to the encoder being used by the instance.
Trait Implementations
impl<E: Debug + Encode, D: Debug + Decode> Debug for TcpTransporter<E, D> where
E::Item: Debug,
[src]
impl<E: Debug + Encode, D: Debug + Decode> Debug for TcpTransporter<E, D> where
E::Item: Debug,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<E: Encode, D: Decode> Transport for TcpTransporter<E, D>
[src]
impl<E: Encode, D: Decode> Transport for TcpTransporter<E, D>
type PeerAddr = ()
Peer address.
type SendItem = E::Item
Outgoing item.
type RecvItem = D::Item
Incoming item.
fn start_send(&mut self, (): Self::PeerAddr, item: Self::SendItem) -> Result<()>
[src]
fn start_send(&mut self, (): Self::PeerAddr, item: Self::SendItem) -> Result<()>
Starts sending the given item to the destination peer.
fn poll_send(&mut self) -> PollSend
[src]
fn poll_send(&mut self) -> PollSend
Polls the transmission of the all outstanding items in the transporter have been completed. Read more
fn poll_recv(&mut self) -> PollRecv<(Self::PeerAddr, Self::RecvItem)>
[src]
fn poll_recv(&mut self) -> PollRecv<(Self::PeerAddr, Self::RecvItem)>
Polls reception of an item from a peer. Read more
impl<E: Encode, D: Decode> TcpTransport for TcpTransporter<E, D>
[src]
impl<E: Encode, D: Decode> TcpTransport for TcpTransporter<E, D>
fn peer_addr(&self) -> SocketAddr
[src]
fn peer_addr(&self) -> SocketAddr
Returns the address of the connected peer.
fn local_addr(&self) -> SocketAddr
[src]
fn local_addr(&self) -> SocketAddr
Returns the address to which the instance is bound.
Auto Trait Implementations
impl<E, D> Send for TcpTransporter<E, D> where
D: Send,
E: Send,
<E as Encode>::Item: Send,
impl<E, D> Send for TcpTransporter<E, D> where
D: Send,
E: Send,
<E as Encode>::Item: Send,
impl<E, D> !Sync for TcpTransporter<E, D>
impl<E, D> !Sync for TcpTransporter<E, D>