pub struct VsockSocket { /* private fields */ }Expand description
A vsock SOCK_STREAM socket. Owns its fd; closes on Drop. This is
the explicit-CID primitive; for the loopback path use the
cross-platform HostVmSocket.
Implementations§
Source§impl VsockSocket
impl VsockSocket
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a fresh vsock SOCK_STREAM socket (not yet bound / connected).
Sourcepub fn bind(&self, cid: u32, port: u32) -> Result<()>
pub fn bind(&self, cid: u32, port: u32) -> Result<()>
Bind to (cid, port). Use VMADDR_CID_ANY to bind to any CID.
Sourcepub fn accept(&self) -> Result<VsockSocket>
pub fn accept(&self) -> Result<VsockSocket>
Accept one incoming vsock connection. Returns the connected socket; the listener stays alive.
Trait Implementations§
Source§impl AsRawFd for VsockSocket
impl AsRawFd for VsockSocket
Source§impl Drop for VsockSocket
impl Drop for VsockSocket
Source§impl FromRawFd for VsockSocket
impl FromRawFd for VsockSocket
Source§unsafe fn from_raw_fd(fd: RawFd) -> Self
unsafe fn from_raw_fd(fd: RawFd) -> Self
Constructs a new instance of
Self from the given raw file
descriptor. Read moreimpl Send for VsockSocket
impl Sync for VsockSocket
Auto Trait Implementations§
impl Freeze for VsockSocket
impl RefUnwindSafe for VsockSocket
impl Unpin for VsockSocket
impl UnsafeUnpin for VsockSocket
impl UnwindSafe for VsockSocket
Blanket Implementations§
Source§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
Mutably borrows from an owned value. Read more