pub struct UnixDatagram { /* private fields */ }
Expand description
UnixDatagram
Implementations§
Source§impl UnixDatagram
impl UnixDatagram
Sourcepub fn bind<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn bind<P: AsRef<Path>>(path: P) -> Result<Self>
Creates a Unix datagram socket bound to the given path.
Sourcepub async fn connect<P: AsRef<Path>>(path: P) -> Result<Self>
pub async fn connect<P: AsRef<Path>>(path: P) -> Result<Self>
Connects the socket to the specified address.
Sourcepub async fn connect_addr(addr: SocketAddr) -> Result<Self>
pub async fn connect_addr(addr: SocketAddr) -> Result<Self>
Connects the socket to an address.
Sourcepub fn from_std(datagram: StdUnixDatagram) -> Result<Self>
pub fn from_std(datagram: StdUnixDatagram) -> Result<Self>
Creates new UnixDatagram
from a std::os::unix::net::UnixDatagram
.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the socket address of the local half of this connection.
Sourcepub fn peer_addr(&self) -> Result<SocketAddr>
pub fn peer_addr(&self) -> Result<SocketAddr>
Returns the socket address of the remote half of this connection.
Sourcepub async fn readable(&self, relaxed: bool) -> Result<()>
pub async fn readable(&self, relaxed: bool) -> Result<()>
Wait for read readiness. Note: Do not use it before every io. It is different from other runtimes!
Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.
If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.
Sourcepub async fn writable(&self, relaxed: bool) -> Result<()>
pub async fn writable(&self, relaxed: bool) -> Result<()>
Wait for write readiness. Note: Do not use it before every io. It is different from other runtimes!
Everytime call to this method may pay a syscall cost. In uring impl, it will push a PollAdd op; in epoll impl, it will use use inner readiness state; if !relaxed, it will call syscall poll after that.
If relaxed, on legacy driver it may return false positive result. If you want to do io by your own, you must maintain io readiness and wait for io ready with relaxed=false.
Sourcepub async fn send_to<T: IoBuf, P: AsRef<Path>>(
&self,
buf: T,
path: P,
) -> BufResult<usize, T>
pub async fn send_to<T: IoBuf, P: AsRef<Path>>( &self, buf: T, path: P, ) -> BufResult<usize, T>
Sends data on the socket to the given address. On success, returns the number of bytes written.
Sourcepub async fn recv_from<T: IoBufMut>(
&self,
buf: T,
) -> BufResult<(usize, SocketAddr), T>
pub async fn recv_from<T: IoBufMut>( &self, buf: T, ) -> BufResult<(usize, SocketAddr), T>
Receives a single datagram message on the socket. On success, returns the number of bytes read and the origin.