Struct cap_std::os::unix::net::UnixDatagram [−][src]
A Unix datagram socket.
This corresponds to std::os::unix::net::UnixDatagram
.
Note that this UnixDatagram
has no bind
, connect
, or send_to
methods. To create a UnixDatagram
,
you must first obtain a Dir
containing the path, and then call
Dir::bind_unix_datagram
, Dir::connect_unix_datagram
, or
Dir::send_to_unix_datagram_addr
.
Implementations
impl UnixDatagram
[src]
pub unsafe fn from_std(std: UnixDatagram) -> Self
[src]
Constructs a new instance of Self
from the given std::os::unix::net::UnixDatagram
.
Safety
std::os::unix::net::UnixDatagram
is not sandboxed and may access any address that
the host process has access to.
pub fn unbound() -> Result<Self>
[src]
Creates a Unix Datagram socket which is not bound to any address.
This corresponds to std::os::unix::net::UnixDatagram::unbound
.
TODO: should this require a capability?
pub fn pair() -> Result<(Self, Self)>
[src]
Creates an unnamed pair of connected sockets.
This corresponds to std::os::unix::net::UnixDatagram::pair
.
TODO: should this require a capability?
pub fn try_clone(&self) -> Result<Self>
[src]
Creates a new independently owned handle to the underlying socket.
This corresponds to std::os::unix::net::UnixDatagram::try_clone
.
pub fn local_addr(&self) -> Result<SocketAddr>
[src]
Returns the address of this socket.
This corresponds to std::os::unix::net::UnixDatagram::local_addr
.
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]
Returns the address of this socket's peer.
This corresponds to std::os::unix::net::UnixDatagram::peer_addr
.
pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
[src]
Receives data from the socket.
This corresponds to std::os::unix::net::UnixDatagram::recv_from
.
pub fn recv(&self, buf: &mut [u8]) -> Result<usize>
[src]
Receives data from the socket.
This corresponds to std::os::unix::net::UnixDatagram::recv
.
pub fn send(&self, buf: &[u8]) -> Result<usize>
[src]
Sends data on the socket to the socket's peer.
This corresponds to std::os::unix::net::UnixDatagram::send
.
pub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>
[src]
Sets the read timeout for the socket.
This corresponds to std::os::unix::net::UnixDatagram::set_read_timeout
.
pub fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<()>
[src]
Sets the write timeout for the socket.
This corresponds to std::os::unix::net::UnixDatagram::set_write_timeout
.
pub fn read_timeout(&self) -> Result<Option<Duration>>
[src]
Returns the read timeout of this socket.
This corresponds to std::os::unix::net::UnixDatagram::read_timeout
.
pub fn write_timeout(&self) -> Result<Option<Duration>>
[src]
Returns the write timeout of this socket.
This corresponds to std::os::unix::net::UnixDatagram::write_timeout
.
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
[src]
Moves the socket into or out of nonblocking mode.
This corresponds to std::os::unix::net::UnixDatagram::set_nonblocking
.
pub fn take_error(&self) -> Result<Option<Error>>
[src]
Returns the value of the SO_ERROR
option.
This corresponds to std::os::unix::net::UnixDatagram::take_error
.
pub fn shutdown(&self, how: Shutdown) -> Result<()>
[src]
Shut down the read, write, or both halves of this connection.
This corresponds to std::os::unix::net::UnixDatagram::shutdown
.
Trait Implementations
impl AsRawFd for UnixDatagram
[src]
impl FromRawFd for UnixDatagram
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
impl IntoRawFd for UnixDatagram
[src]
fn into_raw_fd(self) -> RawFd
[src]
impl OwnsRaw for UnixDatagram
[src]
Auto Trait Implementations
impl RefUnwindSafe for UnixDatagram
impl Send for UnixDatagram
impl Sync for UnixDatagram
impl Unpin for UnixDatagram
impl UnwindSafe for UnixDatagram
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsUnsafeFile for T where
T: OwnsRaw + AsRawFd,
[src]
T: OwnsRaw + AsRawFd,
pub fn as_unsafe_file(&self) -> UnsafeFile
[src]
pub fn as_file_view(&self) -> View<'_, File>
[src]
pub unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]
pub fn eq_file<Filelike>(&self, other: &Filelike) -> bool where
Filelike: AsUnsafeFile,
[src]
Filelike: AsUnsafeFile,
impl<T> AsUnsafeHandle for T where
T: OwnsRaw + AsRawFd,
[src]
T: OwnsRaw + AsRawFd,
pub fn as_unsafe_handle(&self) -> UnsafeHandle
[src]
pub fn eq_handle<Handlelike>(&self, other: &Handlelike) -> bool where
Handlelike: AsUnsafeHandle,
[src]
Handlelike: AsUnsafeHandle,
impl<T> AsUnsafeSocket for T where
T: OwnsRaw + AsRawFd,
[src]
T: OwnsRaw + AsRawFd,
pub fn as_unsafe_socket(&self) -> UnsafeSocket
[src]
pub fn as_tcp_stream_view(&self) -> View<'_, TcpStream>
[src]
pub unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>
[src]
pub fn as_tcp_listener_view(&self) -> View<'_, TcpListener>
[src]
pub unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>
[src]
pub fn as_udp_socket_view(&self) -> View<'_, UdpSocket>
[src]
pub unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>
[src]
pub fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]
pub unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>
[src]
pub fn eq_socket<Socketlike>(&self, other: &Socketlike) -> bool where
Socketlike: AsUnsafeSocket,
[src]
Socketlike: AsUnsafeSocket,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FromUnsafeFile for T where
T: OwnsRaw + FromRawFd,
[src]
T: OwnsRaw + FromRawFd,
pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T
[src]
pub fn from_filelike<Filelike>(filelike: Filelike) -> Self where
Filelike: IntoUnsafeFile,
[src]
Filelike: IntoUnsafeFile,
impl<T> FromUnsafeSocket for T where
T: OwnsRaw + FromRawFd,
[src]
T: OwnsRaw + FromRawFd,
pub unsafe fn from_unsafe_socket(unsafe_socket: UnsafeSocket) -> T
[src]
pub fn from_socketlike<Socketlike>(socketlike: Socketlike) -> Self where
Socketlike: IntoUnsafeSocket,
[src]
Socketlike: IntoUnsafeSocket,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoUnsafeFile for T where
T: OwnsRaw + IntoRawFd,
[src]
T: OwnsRaw + IntoRawFd,
pub fn into_unsafe_file(self) -> UnsafeFile
[src]
impl<T> IntoUnsafeHandle for T where
T: OwnsRaw + IntoRawFd,
[src]
T: OwnsRaw + IntoRawFd,
pub fn into_unsafe_handle(self) -> UnsafeHandle
[src]
impl<T> IntoUnsafeSocket for T where
T: OwnsRaw + IntoRawFd,
[src]
T: OwnsRaw + IntoRawFd,
pub fn into_unsafe_socket(self) -> UnsafeSocket
[src]
impl<T> SetTimes for T where
T: AsRawFd,
T: AsRawFd,
pub fn set_times(
&self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Result<(), Error>
&self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Result<(), Error>
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,