Struct fibers_transport::UdpTransporter [−][src]
An implementation of Transport
that uses UDP as the transport layer.
Methods
impl<E, D> UdpTransporter<E, D> where
E: Encode + Default,
D: Decode + Default,
[src]
impl<E, D> UdpTransporter<E, D> where
E: Encode + Default,
D: Decode + Default,
pub fn bind(
addr: SocketAddr
) -> impl Future<Item = Self, Error = Error>
[src]
pub fn bind(
addr: SocketAddr
) -> impl Future<Item = Self, Error = Error>
Starts binding to the specified address and will makes
a new UdpTransporter
instance if the operation is succeeded.
This is equivalent to UdpTransporterBuilder::new().bind(addr)
.
pub fn from_socket(socket: UdpSocket) -> Result<Self>
[src]
pub fn from_socket(socket: UdpSocket) -> Result<Self>
Makes a new UdpTransporter
instance from the given UdpSocket
.
This is equivalent to UdpTransporterBuilder::new().finish(socket)
.
impl<E: Encode, D: Decode> UdpTransporter<E, D>
[src]
impl<E: Encode, D: Decode> UdpTransporter<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.
pub fn socket_ref(&self) -> &UdpSocket
[src]
pub fn socket_ref(&self) -> &UdpSocket
Returns a reference to the UDP socket being used by the instance.
pub fn socket_mut(&mut self) -> &mut UdpSocket
[src]
pub fn socket_mut(&mut self) -> &mut UdpSocket
Returns a mutable reference to the UDP socket 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 UdpTransporter<E, D> where
E::Item: Debug,
[src]
impl<E: Debug + Encode, D: Debug + Decode> Debug for UdpTransporter<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 UdpTransporter<E, D>
[src]
impl<E: Encode, D: Decode> Transport for UdpTransporter<E, D>
type PeerAddr = SocketAddr
Peer address.
type SendItem = E::Item
Outgoing item.
type RecvItem = D::Item
Incoming item.
fn start_send(&mut self, peer: Self::PeerAddr, item: E::Item) -> Result<()>
[src]
fn start_send(&mut self, peer: Self::PeerAddr, item: E::Item) -> 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, D::Item)>
[src]
fn poll_recv(&mut self) -> PollRecv<(Self::PeerAddr, D::Item)>
Polls reception of an item from a peer. Read more
impl<E: Encode, D: Decode> UdpTransport for UdpTransporter<E, D>
[src]
impl<E: Encode, D: Decode> UdpTransport for UdpTransporter<E, D>
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 UdpTransporter<E, D> where
D: Send,
E: Send,
<E as Encode>::Item: Send,
impl<E, D> Send for UdpTransporter<E, D> where
D: Send,
E: Send,
<E as Encode>::Item: Send,
impl<E, D> !Sync for UdpTransporter<E, D>
impl<E, D> !Sync for UdpTransporter<E, D>