Skip to main content

Socket

Trait Socket 

pub trait Socket:
    Send
    + Sync
    + 'static {
    // Required methods
    fn local_addr(&self) -> Result<SocketAddress, Error>;
    fn peer_addr(&self) -> Result<SocketAddress, Error>;
}
Available on crate feature net only.
Expand description

Common information exposed by a Socket-like construct.

For now this is implemented for TCP and UDP, as these are the types that are relevant to Rama.

Required Methods§

fn local_addr(&self) -> Result<SocketAddress, Error>

Try to get the local address of the socket.

fn peer_addr(&self) -> Result<SocketAddress, Error>

Try to get the remote address of the socket.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl Socket for TcpStream

§

impl Socket for UdpSocket

Implementors§

§

impl Socket for MockSocket

§

impl Socket for rama::tcp::TokioTcpStream

§

impl Socket for rama::tcp::TcpStream

§

impl Socket for rama::udp::UdpSocket

§

impl<C, ID> Socket for LeasedConnection<C, ID>
where ID: Send + Sync + 'static, C: Socket + ExtensionsRef,

§

impl<C, S> Socket for UdpFramedRelay<C, S>
where C: Send + Sync + 'static, S: Send + Sync + 'static,

§

impl<S> Socket for UdpSocketRelay<S>
where S: Send + Sync + 'static,

§

impl<T> Socket for ServiceInput<T>
where T: Socket,