Struct netservices::resource::NetAccept
source · pub struct NetAccept<S: NetSession, L: NetListener<Stream = S::Connection> = TcpListener> { /* private fields */ }
Expand description
A reactor-manageable network listener (TCP, but not limiting to) which can be aware of additional encryption, authentication and other forms of transport-layer protocols which will be automatically injected into accepted connections.
Implementations§
source§impl<L: NetListener<Stream = S::Connection>, S: NetSession> NetAccept<S, L>
impl<L: NetListener<Stream = S::Connection>, S: NetSession> NetAccept<S, L>
sourcepub fn bind(addr: &impl ToSocketAddrs) -> Result<Self>
pub fn bind(addr: &impl ToSocketAddrs) -> Result<Self>
Binds listener to the provided socket address(es) with a given context.
The session_context
object provides information for encryption,
authentication and other protocols which are a part of the application-
specific transport layer and are automatically injected into the
new sessions constructed by this listener before they are inserted into
the reactor
and notifications are delivered to reactor::Handler
.
The injection is made by calling [NetSession::accept
] method.
sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
Returns the local net::SocketAddr
on which listener accepts
connections.
Trait Implementations§
source§impl<L: NetListener<Stream = S::Connection>, S: NetSession> AsRawFd for NetAccept<S, L>
impl<L: NetListener<Stream = S::Connection>, S: NetSession> AsRawFd for NetAccept<S, L>
source§impl<S: Debug + NetSession, L: Debug + NetListener<Stream = S::Connection>> Debug for NetAccept<S, L>
impl<S: Debug + NetSession, L: Debug + NetListener<Stream = S::Connection>> Debug for NetAccept<S, L>
source§impl<L: NetListener<Stream = S::Connection>, S> Resource for NetAccept<S, L>where
S: Send + NetSession,
impl<L: NetListener<Stream = S::Connection>, S> Resource for NetAccept<S, L>where
S: Send + NetSession,
§type Id = SocketAddr
type Id = SocketAddr
§type Event = ListenerEvent<S>
type Event = ListenerEvent<S>
Self::handle_io
. These events are passed to the reactor crate::Handler
.source§fn id(&self) -> Self::Id
fn id(&self) -> Self::Id
ResourceId
.source§impl<L: NetListener<Stream = S::Connection>, S: NetSession> Write for NetAccept<S, L>
impl<L: NetListener<Stream = S::Connection>, S: NetSession> Write for NetAccept<S, L>
source§fn write(&mut self, _buf: &[u8]) -> Result<usize>
fn write(&mut self, _buf: &[u8]) -> Result<usize>
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)source§impl<L: NetListener<Stream = S::Connection>, S: NetSession> WriteAtomic for NetAccept<S, L>
impl<L: NetListener<Stream = S::Connection>, S: NetSession> WriteAtomic for NetAccept<S, L>
source§fn is_ready_to_write(&self) -> bool
fn is_ready_to_write(&self) -> bool
source§fn empty_write_buf(&mut self) -> Result<bool>
fn empty_write_buf(&mut self) -> Result<bool>
io::ErrorKind::WouldBlock
kind of io::Error
. Read moresource§fn write_or_buf(&mut self, _: &[u8]) -> Result<()>
fn write_or_buf(&mut self, _: &[u8]) -> Result<()>
source§fn write_atomic(&mut self, buf: &[u8]) -> Result<(), WriteError>
fn write_atomic(&mut self, buf: &[u8]) -> Result<(), WriteError>
WriteError::NotReady
error.