Struct wasi_cap_std_sync::TcpListener
source · [−]pub struct TcpListener { /* private fields */ }
Expand description
A TCP socket server, listening for connections.
This corresponds to std::net::TcpListener
.
Note that this TcpListener
has no bind
method. To bind it to a socket
address, you must first obtain a Pool
permitting the address, and
then call Pool::bind_tcp_listener
.
Implementations
sourceimpl TcpListener
impl TcpListener
sourcepub fn from_std(std: TcpListener) -> TcpListener
pub fn from_std(std: TcpListener) -> TcpListener
Constructs a new instance of Self
from the given
std::net::TcpListener
.
This grants access the resources the std::net::TcpListener
instance
already has access to.
sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Returns the local socket address of this listener.
This corresponds to std::net::TcpListener::local_addr
.
sourcepub fn try_clone(&self) -> Result<TcpListener, Error>
pub fn try_clone(&self) -> Result<TcpListener, Error>
Creates a new independently owned handle to the underlying socket.
This corresponds to std::net::TcpListener::try_clone
.
sourcepub fn accept(&self) -> Result<(TcpStream, SocketAddr), Error>
pub fn accept(&self) -> Result<(TcpStream, SocketAddr), Error>
Accept a new incoming connection from this listener.
This corresponds to std::net::TcpListener::accept
.
sourcepub fn incoming(&self) -> Incoming<'_>
pub fn incoming(&self) -> Incoming<'_>
Returns an iterator over the connections being received on this listener.
This corresponds to std::net::TcpListener::incoming
.
sourcepub fn set_ttl(&self, ttl: u32) -> Result<(), Error>
pub fn set_ttl(&self, ttl: u32) -> Result<(), Error>
Sets the value for the IP_TTL
option on this socket.
This corresponds to std::net::TcpListener::set_ttl
.
sourcepub fn ttl(&self) -> Result<u32, Error>
pub fn ttl(&self) -> Result<u32, Error>
Gets the value of the IP_TTL
option for this socket.
This corresponds to std::net::TcpListener::ttl
.
sourcepub fn take_error(&self) -> Result<Option<Error>, Error>
pub fn take_error(&self) -> Result<Option<Error>, Error>
Gets the value of the SO_ERROR
option on this socket.
This corresponds to std::net::TcpListener::take_error
.
sourcepub fn set_nonblocking(&self, nonblocking: bool) -> Result<(), Error>
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<(), Error>
Moves this TCP stream into or out of nonblocking mode.
This corresponds to std::net::TcpListener::set_nonblocking
.
Trait Implementations
sourceimpl AsRawHandleOrSocket for TcpListener
impl AsRawHandleOrSocket for TcpListener
sourcepub fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket
pub fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket
Like AsRawHandle::as_raw_handle
and AsRawSocket::as_raw_socket
but can return either type. Read more
sourceimpl AsRawSocket for TcpListener
impl AsRawSocket for TcpListener
sourcepub fn as_raw_socket(&self) -> u32
pub fn as_raw_socket(&self) -> u32
Extracts the underlying raw socket from this object.
sourceimpl AsSocket for TcpListener
impl AsSocket for TcpListener
sourcepub fn as_socket(&self) -> BorrowedSocket<'_>
pub fn as_socket(&self) -> BorrowedSocket<'_>
Borrows the socket.
sourceimpl Debug for TcpListener
impl Debug for TcpListener
sourceimpl From<TcpListener> for Socket
impl From<TcpListener> for Socket
sourcefn from(listener: TcpListener) -> Self
fn from(listener: TcpListener) -> Self
Performs the conversion.
sourceimpl FromRawSocket for TcpListener
impl FromRawSocket for TcpListener
sourcepub unsafe fn from_raw_socket(socket: u32) -> TcpListener
pub unsafe fn from_raw_socket(socket: u32) -> TcpListener
Creates a new I/O object from the given raw socket. Read more
sourceimpl FromSocket for TcpListener
impl FromSocket for TcpListener
sourcepub fn from_socket(socket: OwnedSocket) -> TcpListener
pub fn from_socket(socket: OwnedSocket) -> TcpListener
Constructs a new instance of Self
from the given socket.
sourcefn from_into_socket<Owned>(into_owned: Owned) -> Self where
Owned: IntoSocket,
fn from_into_socket<Owned>(into_owned: Owned) -> Self where
Owned: IntoSocket,
Constructs a new instance of Self
from the given socket converted
from into_owned
. Read more
sourceimpl IntoRawHandleOrSocket for TcpListener
impl IntoRawHandleOrSocket for TcpListener
sourcepub fn into_raw_handle_or_socket(self) -> RawHandleOrSocket
pub fn into_raw_handle_or_socket(self) -> RawHandleOrSocket
Like IntoRawHandle::into_raw_handle
and
IntoRawSocket::into_raw_socket
but can return either type. Read more
sourceimpl IntoRawSocket for TcpListener
impl IntoRawSocket for TcpListener
sourcepub fn into_raw_socket(self) -> u32
pub fn into_raw_socket(self) -> u32
Consumes this object, returning the raw underlying socket. Read more
sourceimpl IntoSocket for TcpListener
impl IntoSocket for TcpListener
sourcepub fn into_socket(self) -> OwnedSocket
pub fn into_socket(self) -> OwnedSocket
Consumes this object, returning the underlying socket.
Auto Trait Implementations
impl RefUnwindSafe for TcpListener
impl Send for TcpListener
impl Sync for TcpListener
impl Unpin for TcpListener
impl UnwindSafe for TcpListener
Blanket Implementations
sourceimpl<T> AsRawGrip for T where
T: AsRawHandleOrSocket,
impl<T> AsRawGrip for T where
T: AsRawHandleOrSocket,
sourcepub fn as_raw_grip(&self) -> RawHandleOrSocket
pub fn as_raw_grip(&self) -> RawHandleOrSocket
Extracts the raw grip.
sourceimpl<T> AsRawSocketlike for T where
T: AsRawSocket,
impl<T> AsRawSocketlike for T where
T: AsRawSocket,
sourcepub fn as_raw_socketlike(&self) -> u32
pub fn as_raw_socketlike(&self) -> u32
Returns the raw value.
sourceimpl<T> AsSocketlike for T where
T: AsSocket,
impl<T> AsSocketlike for T where
T: AsSocket,
sourcepub fn as_socketlike(&self) -> BorrowedSocket<'_>
pub fn as_socketlike(&self) -> BorrowedSocket<'_>
Borrows the reference.
sourcepub fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target> where
Target: FromSocketlike + IntoSocketlike,
pub fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target> where
Target: FromSocketlike + IntoSocketlike,
Return a borrowing view of a resource which dereferences to a &Target
or &mut Target
. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromRawSocketlike for T where
T: FromRawSocket,
impl<T> FromRawSocketlike for T where
T: FromRawSocket,
sourcepub unsafe fn from_raw_socketlike(raw: u32) -> T
pub unsafe fn from_raw_socketlike(raw: u32) -> T
Constructs Self
from the raw value.
sourceimpl<T> FromSocketlike for T where
T: FromSocket,
impl<T> FromSocketlike for T where
T: FromSocket,
sourcepub fn from_socketlike(owned: OwnedSocket) -> T
pub fn from_socketlike(owned: OwnedSocket) -> T
Constructs a new instance of Self
from the given socketlike object.
sourcepub fn from_into_socketlike<Owned>(owned: Owned) -> T where
Owned: IntoSocketlike,
pub fn from_into_socketlike<Owned>(owned: Owned) -> T where
Owned: IntoSocketlike,
Constructs a new instance of Self
from the given socketlike object
converted from into_owned
. Read more
sourceimpl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
sourcepub fn get_fd_flags(&self) -> Result<FdFlags, Error> where
T: AsFilelike,
pub fn get_fd_flags(&self) -> Result<FdFlags, Error> where
T: AsFilelike,
Query the “status” flags for the self
file descriptor.
sourcepub fn new_set_fd_flags(
&self,
fd_flags: FdFlags
) -> Result<SetFdFlags<T>, Error> where
T: AsFilelike + FromFilelike,
pub fn new_set_fd_flags(
&self,
fd_flags: FdFlags
) -> Result<SetFdFlags<T>, Error> where
T: AsFilelike + FromFilelike,
Create a new SetFdFlags
value for use with set_fd_flags
. Read more
sourcepub fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error> where
T: AsFilelike,
pub fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error> where
T: AsFilelike,
Set the “status” flags for the self
file descriptor. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRawGrip for T where
T: IntoRawHandleOrSocket,
impl<T> IntoRawGrip for T where
T: IntoRawHandleOrSocket,
sourcepub fn into_raw_grip(self) -> RawHandleOrSocket
pub fn into_raw_grip(self) -> RawHandleOrSocket
Consume self
and convert into an RawGrip
.
sourceimpl<T> IntoRawSocketlike for T where
T: IntoRawSocket,
impl<T> IntoRawSocketlike for T where
T: IntoRawSocket,
sourcepub fn into_raw_socketlike(self) -> u32
pub fn into_raw_socketlike(self) -> u32
Returns the raw value.
sourceimpl<T> IntoSocketlike for T where
T: IntoSocket,
impl<T> IntoSocketlike for T where
T: IntoSocket,
sourcepub fn into_socketlike(self) -> OwnedSocket
pub fn into_socketlike(self) -> OwnedSocket
Consumes this object, returning the underlying socketlike object. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more