Struct vsock::VsockListener

source ·
pub struct VsockListener { /* private fields */ }
Expand description

A virtio socket server, listening for connections.

Implementations§

source§

impl VsockListener

source

pub fn bind(addr: &impl SockaddrLike) -> Result<Self>

Create a new VsockListener which is bound and listening on the socket address.

source

pub fn bind_with_cid_port(cid: u32, port: u32) -> Result<VsockListener>

Create a new VsockListener with specified cid and port.

source

pub fn local_addr(&self) -> Result<VsockAddr>

The local socket address of the listener.

source

pub fn try_clone(&self) -> Result<Self>

Create a new independently owned handle to the underlying socket.

source

pub fn accept(&self) -> Result<(VsockStream, VsockAddr)>

Accept a new incoming connection from this listener.

source

pub fn incoming(&self) -> Incoming<'_>

An iterator over the connections being received on this listener.

source

pub fn take_error(&self) -> Result<Option<Error>>

Retrieve the latest error associated with the underlying socket.

source

pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>

Move this stream in and out of nonblocking mode.

Trait Implementations§

source§

impl AsFd for VsockListener

source§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
source§

impl AsRawFd for VsockListener

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl Debug for VsockListener

source§

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

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

impl FromRawFd for VsockListener

source§

unsafe fn from_raw_fd(socket: RawFd) -> Self

Constructs a new instance of Self from the given raw file descriptor. Read more
source§

impl IntoRawFd for VsockListener

source§

fn into_raw_fd(self) -> RawFd

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations§

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>,

§

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>,

§

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.