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
.
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§
source§impl 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§
source§impl AsFd for TcpListener
impl AsFd for TcpListener
source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
source§impl AsRawFd for TcpListener
impl AsRawFd for TcpListener
source§impl Debug for TcpListener
impl Debug for TcpListener
source§impl From<OwnedFd> for TcpListener
impl From<OwnedFd> for TcpListener
source§fn from(fd: OwnedFd) -> TcpListener
fn from(fd: OwnedFd) -> TcpListener
source§impl From<TcpListener> for Socket
impl From<TcpListener> for Socket
source§fn from(listener: TcpListener) -> Self
fn from(listener: TcpListener) -> Self
source§impl FromRawFd for TcpListener
impl FromRawFd for TcpListener
source§unsafe fn from_raw_fd(fd: i32) -> TcpListener
unsafe fn from_raw_fd(fd: i32) -> TcpListener
Self
from the given raw file
descriptor. Read moresource§impl IntoRawFd for TcpListener
impl IntoRawFd for TcpListener
source§fn into_raw_fd(self) -> i32
fn into_raw_fd(self) -> i32
impl SocketlikeViewType for TcpListener
Auto Trait Implementations§
impl Freeze for TcpListener
impl RefUnwindSafe for TcpListener
impl Send for TcpListener
impl Sync for TcpListener
impl Unpin for TcpListener
impl UnwindSafe for TcpListener
Blanket Implementations§
source§impl<T> AsFilelike for Twhere
T: AsFd,
impl<T> AsFilelike for Twhere
T: AsFd,
source§fn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
source§fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
&Target
. Read moresource§impl<T> AsGrip for Twhere
T: AsFd,
impl<T> AsGrip for Twhere
T: AsFd,
source§fn as_grip(&self) -> BorrowedFd<'_>
fn as_grip(&self) -> BorrowedFd<'_>
source§impl<T> AsRawFilelike for Twhere
T: AsRawFd,
impl<T> AsRawFilelike for Twhere
T: AsRawFd,
source§fn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
source§impl<T> AsRawGrip for Twhere
T: AsRawFd,
impl<T> AsRawGrip for Twhere
T: AsRawFd,
source§fn as_raw_grip(&self) -> i32
fn as_raw_grip(&self) -> i32
source§impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
source§fn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
source§impl<T> AsSocketlike for Twhere
T: AsFd,
impl<T> AsSocketlike for Twhere
T: AsFd,
source§fn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
source§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
&Target
. Read moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> FileIoExt for Twhere
T: AsFilelike + IoExt,
impl<T> FileIoExt for Twhere
T: AsFilelike + IoExt,
source§fn advise(&self, offset: u64, len: u64, advice: Advice) -> Result<(), Error>
fn advise(&self, offset: u64, len: u64, advice: Advice) -> Result<(), Error>
source§fn allocate(&self, offset: u64, len: u64) -> Result<(), Error>
fn allocate(&self, offset: u64, len: u64) -> Result<(), Error>
source§fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize, Error>
fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize, Error>
source§fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<(), Error>
fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<(), Error>
source§fn read_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<usize, Error>
fn read_vectored_at( &self, bufs: &mut [IoSliceMut<'_>], offset: u64 ) -> Result<usize, Error>
read_vectored
what read_at
is to read
.source§fn is_read_vectored_at(&self) -> bool
fn is_read_vectored_at(&self) -> bool
FileIoExt
implementation has an efficient
read_vectored_at
implementation.source§fn read_to_end_at(&self, buf: &mut Vec<u8>, offset: u64) -> Result<usize, Error>
fn read_to_end_at(&self, buf: &mut Vec<u8>, offset: u64) -> Result<usize, Error>
offset
, until EOF in this source, placing
them into buf
.source§fn read_to_string_at(
&self,
buf: &mut String,
offset: u64
) -> Result<usize, Error>
fn read_to_string_at( &self, buf: &mut String, offset: u64 ) -> Result<usize, Error>
offset
, until EOF in this source,
appending them to buf
.source§fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize, Error>
fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize, Error>
source§fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<(), Error>
fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<(), Error>
source§fn write_vectored_at(
&self,
bufs: &[IoSlice<'_>],
offset: u64
) -> Result<usize, Error>
fn write_vectored_at( &self, bufs: &[IoSlice<'_>], offset: u64 ) -> Result<usize, Error>
write_vectored
what write_at
is to write
.source§fn is_write_vectored_at(&self) -> bool
fn is_write_vectored_at(&self) -> bool
FileIoExt
implementation has an efficient
write_vectored_at
implementation.source§fn append(&self, buf: &[u8]) -> Result<usize, Error>
fn append(&self, buf: &[u8]) -> Result<usize, Error>
source§fn append_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
fn append_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
append
what write_vectored
is to write
.source§fn is_append_vectored(&self) -> bool
fn is_append_vectored(&self) -> bool
FileIoExt
implementation has an efficient
append_vectored
implementation.source§fn seek(&self, pos: SeekFrom) -> Result<u64, Error>
fn seek(&self, pos: SeekFrom) -> Result<u64, Error>
source§fn stream_position(&self) -> Result<u64, Error>
fn stream_position(&self) -> Result<u64, Error>
source§fn read_exact_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<(), Error>
fn read_exact_vectored_at( &self, bufs: &mut [IoSliceMut<'_>], offset: u64 ) -> Result<(), Error>
read_exact_vectored
what read_exact_at
is to read_exact
.source§fn write_all_vectored_at(
&self,
bufs: &mut [IoSlice<'_>],
offset: u64
) -> Result<(), Error>
fn write_all_vectored_at( &self, bufs: &mut [IoSlice<'_>], offset: u64 ) -> Result<(), Error>
write_all_vectored
what write_all_at
is to write_all
.source§impl<T> FromFd for T
impl<T> FromFd for T
source§impl<T> FromFilelike for T
impl<T> FromFilelike for T
source§fn from_filelike(owned: OwnedFd) -> T
fn from_filelike(owned: OwnedFd) -> T
Self
from the given filelike object. Read moresource§fn 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 moresource§impl<T> FromRawFilelike for Twhere
T: FromRawFd,
impl<T> FromRawFilelike for Twhere
T: FromRawFd,
source§unsafe fn from_raw_filelike(raw: i32) -> T
unsafe fn from_raw_filelike(raw: i32) -> T
Self
from the raw value. Read moresource§impl<T> FromRawGrip for Twhere
T: FromRawFd,
impl<T> FromRawGrip for Twhere
T: FromRawFd,
source§unsafe fn from_raw_grip(raw_grip: i32) -> T
unsafe fn from_raw_grip(raw_grip: i32) -> T
source§impl<T> FromRawSocketlike for Twhere
T: FromRawFd,
impl<T> FromRawSocketlike for Twhere
T: FromRawFd,
source§unsafe fn from_raw_socketlike(raw: i32) -> T
unsafe fn from_raw_socketlike(raw: i32) -> T
Self
from the raw value. Read moresource§impl<T> FromSocketlike for T
impl<T> FromSocketlike for T
source§fn from_socketlike(owned: OwnedFd) -> T
fn from_socketlike(owned: OwnedFd) -> T
Self
from the given socketlike object.source§fn 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
.source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self
file descriptor.source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self
file descriptor. Read moresource§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoFilelike for T
impl<T> IntoFilelike for T
source§fn into_filelike(self) -> OwnedFd
fn into_filelike(self) -> OwnedFd
source§impl<T> IntoRawFilelike for Twhere
T: IntoRawFd,
impl<T> IntoRawFilelike for Twhere
T: IntoRawFd,
source§fn into_raw_filelike(self) -> i32
fn into_raw_filelike(self) -> i32
source§impl<T> IntoRawGrip for Twhere
T: IntoRawFd,
impl<T> IntoRawGrip for Twhere
T: IntoRawFd,
source§fn into_raw_grip(self) -> i32
fn into_raw_grip(self) -> i32
self
and convert into an RawGrip
.source§impl<T> IntoRawSocketlike for Twhere
T: IntoRawFd,
impl<T> IntoRawSocketlike for Twhere
T: IntoRawFd,
source§fn into_raw_socketlike(self) -> i32
fn into_raw_socketlike(self) -> i32
source§impl<T> IntoSocketlike for T
impl<T> IntoSocketlike for T
source§fn into_socketlike(self) -> OwnedFd
fn into_socketlike(self) -> OwnedFd
source§impl<T> IoExt for Twhere
T: AsFilelike + AsSocketlike,
impl<T> IoExt for Twhere
T: AsFilelike + AsSocketlike,
source§fn read(&self, buf: &mut [u8]) -> Result<usize, Error>
fn read(&self, buf: &mut [u8]) -> Result<usize, Error>
source§fn read_exact(&self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moresource§fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moresource§fn read_to_end(&self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read moresource§fn read_to_string(&self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&self, buf: &mut String) -> Result<usize, Error>
buf
. Read moresource§fn peek(&self, buf: &mut [u8]) -> Result<usize, Error>
fn peek(&self, buf: &mut [u8]) -> Result<usize, Error>
source§fn write(&self, buf: &[u8]) -> Result<usize, Error>
fn write(&self, buf: &[u8]) -> Result<usize, Error>
source§fn write_all(&self, buf: &[u8]) -> Result<(), Error>
fn write_all(&self, buf: &[u8]) -> Result<(), Error>
source§fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>
write
, except that it writes from a slice of buffers. Read moresource§fn flush(&self) -> Result<(), Error>
fn flush(&self) -> Result<(), Error>
source§fn write_fmt(&self, fmt: Arguments<'_>) -> Result<(), Error>
fn write_fmt(&self, fmt: Arguments<'_>) -> Result<(), Error>
source§fn read_exact_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<(), Error>
fn read_exact_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<(), Error>
read_vectored
what read_exact
is to read
.