Struct std::sys::unix::net::Socket

source ·
pub struct Socket(FileDesc);

Tuple Fields§

§0: FileDesc

Implementations§

source§

impl Socket

source

pub fn new(addr: &SocketAddr, ty: c_int) -> Result<Socket>

source

pub fn new_raw(fam: c_int, ty: c_int) -> Result<Socket>

source

pub fn new_pair(fam: c_int, ty: c_int) -> Result<(Socket, Socket)>

source

pub fn connect_timeout( &self, addr: &SocketAddr, timeout: Duration ) -> Result<()>

source

pub fn accept( &self, storage: *mut sockaddr, len: *mut socklen_t ) -> Result<Socket>

source

pub fn duplicate(&self) -> Result<Socket>

source

fn recv_with_flags(&self, buf: BorrowedCursor<'_>, flags: c_int) -> Result<()>

source

pub fn read(&self, buf: &mut [u8]) -> Result<usize>

source

pub fn peek(&self, buf: &mut [u8]) -> Result<usize>

source

pub fn read_buf(&self, buf: BorrowedCursor<'_>) -> Result<()>

source

pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>

source

pub fn is_read_vectored(&self) -> bool

source

fn recv_from_with_flags( &self, buf: &mut [u8], flags: c_int ) -> Result<(usize, SocketAddr)>

source

pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>

source

pub fn recv_msg(&self, msg: &mut msghdr) -> Result<usize>

source

pub fn peek_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>

source

pub fn write(&self, buf: &[u8]) -> Result<usize>

source

pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize>

source

pub fn is_write_vectored(&self) -> bool

source

pub fn send_msg(&self, msg: &mut msghdr) -> Result<usize>

source

pub fn set_timeout(&self, dur: Option<Duration>, kind: c_int) -> Result<()>

source

pub fn timeout(&self, kind: c_int) -> Result<Option<Duration>>

source

pub fn shutdown(&self, how: Shutdown) -> Result<()>

source

pub fn set_linger(&self, linger: Option<Duration>) -> Result<()>

source

pub fn linger(&self) -> Result<Option<Duration>>

source

pub fn set_nodelay(&self, nodelay: bool) -> Result<()>

source

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

source

pub fn set_quickack(&self, quickack: bool) -> Result<()>

source

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

source

pub fn set_passcred(&self, passcred: bool) -> Result<()>

source

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

source

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

source

pub fn set_mark(&self, mark: u32) -> Result<()>

source

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

source

pub fn as_raw(&self) -> RawFd

Trait Implementations§

source§

impl AsFd for Socket

source§

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

Borrows the file descriptor. Read more
source§

impl AsRawFd for Socket

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl FromRawFd for Socket

source§

unsafe fn from_raw_fd(raw_fd: RawFd) -> Self

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

impl IntoRawFd for Socket

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.