Struct SocketListener

Source
pub struct SocketListener<P, S> { /* private fields */ }
Expand description

Provides an ability to accept new connections.

Implementations§

Source§

impl<P: Protocol, S: Socket<P>> SocketListener<P, S>

Source

pub fn new(ctx: &IoContext, pro: P) -> Result<SocketListener<P, S>>

Source

pub fn accept(&self) -> Result<(S, P::Endpoint)>

Source

pub fn async_accept<F>(&self, handler: F) -> F::Output
where F: Handler<(S, P::Endpoint), Error>,

Source

pub fn bind(&self, ep: &P::Endpoint) -> Result<()>

Source

pub fn cancel(&self) -> &Self

Source

pub fn listen(&self) -> Result<()>

Source

pub fn local_endpoint(&self) -> Result<P::Endpoint>

Source

pub fn io_control<T>(&self, cmd: &mut T) -> Result<()>
where T: IoControl,

Source

pub fn get_non_blocking(&self) -> Result<bool>

Source

pub fn get_option<C>(&self) -> Result<C>
where C: GetSocketOption<P>,

Source

pub fn set_non_blocking(&self, on: bool) -> Result<()>

Source

pub fn set_option<C>(&self, cmd: C) -> Result<()>
where C: SetSocketOption<P>,

Trait Implementations§

Source§

impl<P, S> AsIoContext for SocketListener<P, S>

Source§

impl<P, S> AsRawFd for SocketListener<P, S>

Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl<P: Protocol, S> Debug for SocketListener<P, S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Protocol, S: Socket<P>> Socket<P> for SocketListener<P, S>

Source§

unsafe fn from_raw_fd( ctx: &IoContext, pro: P, fd: RawFd, ) -> SocketListener<P, S>

Source§

fn protocol(&self) -> P

Source§

impl<P, S> Send for SocketListener<P, S>

Auto Trait Implementations§

§

impl<P, S> Freeze for SocketListener<P, S>
where P: Freeze,

§

impl<P, S> !RefUnwindSafe for SocketListener<P, S>

§

impl<P, S> !Sync for SocketListener<P, S>

§

impl<P, S> Unpin for SocketListener<P, S>
where P: Unpin, S: Unpin,

§

impl<P, S> !UnwindSafe for SocketListener<P, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.