Struct cap_std::net::TcpListener
source · pub struct TcpListener { /* private fields */ }
Expand description
A TCP socket server, listening for connections.
This corresponds to std::net::TcpListener
.
This TcpListener
has no bind
method. To bind it to a socket address,
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) -> Self
pub fn from_std(std: TcpListener) -> Self
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>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the local socket address of this listener.
This corresponds to std::net::TcpListener::local_addr
.
sourcepub fn try_clone(&self) -> Result<Self>
pub fn try_clone(&self) -> Result<Self>
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)>
pub fn accept(&self) -> Result<(TcpStream, SocketAddr)>
Accept a new incoming connection from this listener.
This corresponds to std::net::TcpListener::accept
.
sourcepub fn incoming(&self) -> Incoming<'_>ⓘNotable traits for Incoming<'a>impl<'a> Iterator for Incoming<'a> type Item = Result<TcpStream>;
pub fn incoming(&self) -> Incoming<'_>ⓘNotable traits for Incoming<'a>impl<'a> Iterator for Incoming<'a> type Item = Result<TcpStream>;
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<()>
pub fn set_ttl(&self, ttl: u32) -> Result<()>
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>
pub fn ttl(&self) -> Result<u32>
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>>
pub fn take_error(&self) -> Result<Option<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<()>
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
Moves this TCP stream into or out of nonblocking mode.
This corresponds to std::net::TcpListener::set_nonblocking
.
Trait Implementations
sourceimpl AsFd for TcpListener
Available on non-Windows only.
impl AsFd for TcpListener
sourcefn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
sourceimpl AsRawFd for TcpListener
Available on non-Windows only.
impl AsRawFd for TcpListener
sourceimpl Debug for TcpListener
impl Debug for TcpListener
sourceimpl From<OwnedFd> for TcpListener
Available on non-Windows only.
impl From<OwnedFd> for TcpListener
sourceimpl From<TcpListener> for OwnedFd
Available on non-Windows only.
impl From<TcpListener> for OwnedFd
sourcefn from(listener: TcpListener) -> OwnedFd
fn from(listener: TcpListener) -> OwnedFd
sourceimpl FromRawFd for TcpListener
Available on non-Windows only.
impl FromRawFd for TcpListener
sourceunsafe fn from_raw_fd(fd: RawFd) -> Self
unsafe fn from_raw_fd(fd: RawFd) -> Self
Self
from the given raw file
descriptor. Read moresourceimpl IntoRawFd for TcpListener
Available on non-Windows only.
impl IntoRawFd for TcpListener
sourcefn into_raw_fd(self) -> RawFd
fn into_raw_fd(self) -> RawFd
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> AsFilelike for Twhere
T: AsFd,
impl<T> AsFilelike for Twhere
T: AsFd,
sourcefn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
sourcefn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
&Target
. Read moresourceimpl<T> AsRawFilelike for Twhere
T: AsRawFd,
impl<T> AsRawFilelike for Twhere
T: AsRawFd,
sourcefn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
sourceimpl<T> AsRawGrip for Twhere
T: AsRawFd,
impl<T> AsRawGrip for Twhere
T: AsRawFd,
sourcefn as_raw_grip(&self) -> i32
fn as_raw_grip(&self) -> i32
sourceimpl<T> AsRawSocketlike for Twhere
T: AsRawFd,
impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
sourcefn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
sourceimpl<T> AsSocketlike for Twhere
T: AsFd,
impl<T> AsSocketlike for Twhere
T: AsFd,
sourcefn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
sourcefn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
&Target
. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> FromFd for Twhere
T: From<OwnedFd>,
impl<T> FromFd for Twhere
T: From<OwnedFd>,
sourceimpl<T> FromFilelike for Twhere
T: From<OwnedFd>,
impl<T> FromFilelike for Twhere
T: From<OwnedFd>,
sourcefn from_filelike(owned: OwnedFd) -> T
fn from_filelike(owned: OwnedFd) -> T
Self
from the given filelike object. Read moresourcefn from_into_filelike<Owned>(owned: Owned) -> Twhere
Owned: IntoFilelike,
fn from_into_filelike<Owned>(owned: Owned) -> Twhere
Owned: IntoFilelike,
Self
from the given filelike object
converted from into_owned
. Read moresourceimpl<T> FromRawFilelike for Twhere
T: FromRawFd,
impl<T> FromRawFilelike for Twhere
T: FromRawFd,
sourceunsafe fn from_raw_filelike(raw: i32) -> T
unsafe fn from_raw_filelike(raw: i32) -> T
Self
from the raw value. Read moresourceimpl<T> FromRawGrip for Twhere
T: FromRawFd,
impl<T> FromRawGrip for Twhere
T: FromRawFd,
sourceunsafe fn from_raw_grip(raw_grip: i32) -> T
unsafe fn from_raw_grip(raw_grip: i32) -> T
sourceimpl<T> FromRawSocketlike for Twhere
T: FromRawFd,
impl<T> FromRawSocketlike for Twhere
T: FromRawFd,
sourceunsafe fn from_raw_socketlike(raw: i32) -> T
unsafe fn from_raw_socketlike(raw: i32) -> T
Self
from the raw value. Read moresourceimpl<T> FromSocketlike for Twhere
T: From<OwnedFd>,
impl<T> FromSocketlike for Twhere
T: From<OwnedFd>,
sourcefn from_socketlike(owned: OwnedFd) -> T
fn from_socketlike(owned: OwnedFd) -> T
Self
from the given socketlike object.sourcefn from_into_socketlike<Owned>(owned: Owned) -> Twhere
Owned: IntoSocketlike,
fn from_into_socketlike<Owned>(owned: Owned) -> Twhere
Owned: IntoSocketlike,
Self
from the given socketlike object
converted from into_owned
. Read moresourceimpl<T> IntoFilelike for Twhere
T: Into<OwnedFd>,
impl<T> IntoFilelike for Twhere
T: Into<OwnedFd>,
sourcefn into_filelike(self) -> OwnedFd
fn into_filelike(self) -> OwnedFd
sourceimpl<T> IntoRawFilelike for Twhere
T: IntoRawFd,
impl<T> IntoRawFilelike for Twhere
T: IntoRawFd,
sourcefn into_raw_filelike(self) -> i32
fn into_raw_filelike(self) -> i32
sourceimpl<T> IntoRawGrip for Twhere
T: IntoRawFd,
impl<T> IntoRawGrip for Twhere
T: IntoRawFd,
sourcefn into_raw_grip(self) -> i32
fn into_raw_grip(self) -> i32
self
and convert into an RawGrip
.