[−][src]Struct romio::uds::UnixStream
A structure representing a connected Unix socket.
This socket can be connected directly with UnixStream::connect
or accepted
from a listener with UnixListener::incoming
. Additionally, a pair of
anonymous Unix sockets can be created with UnixStream::pair
.
Methods
impl UnixStream
[src]
impl UnixStream
pub fn connect(
path: impl AsRef<Path>
) -> ConnectFuture
[src]
pub fn connect(
path: impl AsRef<Path>
) -> ConnectFuture
Connects to the socket named by path
.
This function will create a new Unix socket and connect to the path specified, associating the returned stream with the default event loop's handle.
Examples
#![feature(async_await, await_macro, futures_api)] use romio::uds::UnixStream; let stream = await!(UnixStream::connect("/tmp/sock"));
pub fn pair() -> Result<(UnixStream, UnixStream)>
[src]
pub fn pair() -> Result<(UnixStream, UnixStream)>
Creates an unnamed pair of connected sockets.
This function will create a pair of interconnected Unix sockets for communicating back and forth between one another. Each socket will be associated with the event loop whose handle is also provided.
Examples
#![feature(async_await, await_macro, futures_api)] use romio::uds::UnixStream; let (sock1, sock2) = UnixStream::pair()?;
pub fn poll_read_ready(&self, lw: &LocalWaker) -> Poll<Result<Ready>>
[src]
pub fn poll_read_ready(&self, lw: &LocalWaker) -> Poll<Result<Ready>>
Test whether this socket is ready to be read or not.
pub fn poll_write_ready(&self, lw: &LocalWaker) -> Poll<Result<Ready>>
[src]
pub fn poll_write_ready(&self, lw: &LocalWaker) -> Poll<Result<Ready>>
Test whether this socket is ready to be written to or not.
pub fn local_addr(&self) -> Result<SocketAddr>
[src]
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the socket address of the local half of this connection.
Examples
#![feature(async_await, await_macro, futures_api)] use romio::uds::UnixStream; let stream = await!(UnixStream::connect("/tmp/sock"))?; let addr = stream.local_addr()?;
pub fn peer_addr(&self) -> Result<SocketAddr>
[src]
pub fn peer_addr(&self) -> Result<SocketAddr>
Returns the socket address of the remote half of this connection.
Examples
#![feature(async_await, await_macro, futures_api)] use romio::uds::UnixStream; let stream = await!(UnixStream::connect("/tmp/sock"))?; let addr = stream.peer_addr()?;
pub fn peer_cred(&self) -> Result<UCred>
[src]
pub fn peer_cred(&self) -> Result<UCred>
Returns effective credentials of the process which called connect
or socketpair
.
Examples
#![feature(async_await, await_macro, futures_api)] use romio::uds::UnixStream; let stream = await!(UnixStream::connect("/tmp/sock"))?; let cred = stream.peer_cred()?;
pub fn take_error(&self) -> Result<Option<Error>>
[src]
pub fn take_error(&self) -> Result<Option<Error>>
Returns the value of the SO_ERROR
option.
Examples
#![feature(async_await, await_macro, futures_api)] use romio::uds::UnixStream; let stream = await!(UnixStream::connect("/tmp/sock"))?; if let Ok(Some(err)) = stream.take_error() { println!("Got error: {:?}", err); }
pub fn shutdown(&self, how: Shutdown) -> Result<()>
[src]
pub fn shutdown(&self, how: Shutdown) -> Result<()>
Shuts down the read, write, or both halves of this connection.
This function will cause all pending and future I/O calls on the
specified portions to immediately return with an appropriate value
(see the documentation of Shutdown
).
#![feature(async_await, await_macro, futures_api)] use romio::uds::UnixStream; use std::net::Shutdown; let stream = await!(UnixStream::connect("/tmp/sock"))?; stream.shutdown(Shutdown::Both)?;
Trait Implementations
impl Debug for UnixStream
[src]
impl Debug for UnixStream
impl AsRawFd for UnixStream
[src]
impl AsRawFd for UnixStream
impl AsyncWrite for UnixStream
[src]
impl AsyncWrite for UnixStream
fn poll_write(&mut self, lw: &LocalWaker, buf: &[u8]) -> Poll<Result<usize>>
[src]
fn poll_write(&mut self, lw: &LocalWaker, buf: &[u8]) -> Poll<Result<usize>>
fn poll_vectored_write(
&mut self,
lw: &LocalWaker,
vec: &[&IoVec]
) -> Poll<Result<usize>>
[src]
fn poll_vectored_write(
&mut self,
lw: &LocalWaker,
vec: &[&IoVec]
) -> Poll<Result<usize>>
fn poll_flush(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
[src]
fn poll_flush(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
fn poll_close(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
[src]
fn poll_close(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
impl<'a> AsyncWrite for &'a UnixStream
[src]
impl<'a> AsyncWrite for &'a UnixStream
fn poll_write(&mut self, lw: &LocalWaker, buf: &[u8]) -> Poll<Result<usize>>
[src]
fn poll_write(&mut self, lw: &LocalWaker, buf: &[u8]) -> Poll<Result<usize>>
fn poll_vectored_write(
&mut self,
lw: &LocalWaker,
bufs: &[&IoVec]
) -> Poll<Result<usize>>
[src]
fn poll_vectored_write(
&mut self,
lw: &LocalWaker,
bufs: &[&IoVec]
) -> Poll<Result<usize>>
fn poll_flush(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
[src]
fn poll_flush(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
fn poll_close(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
[src]
fn poll_close(&mut self, lw: &LocalWaker) -> Poll<Result<()>>
impl AsyncRead for UnixStream
[src]
impl AsyncRead for UnixStream
fn poll_read(&mut self, lw: &LocalWaker, buf: &mut [u8]) -> Poll<Result<usize>>
[src]
fn poll_read(&mut self, lw: &LocalWaker, buf: &mut [u8]) -> Poll<Result<usize>>
fn poll_vectored_read(
&mut self,
lw: &LocalWaker,
vec: &mut [&mut IoVec]
) -> Poll<Result<usize>>
[src]
fn poll_vectored_read(
&mut self,
lw: &LocalWaker,
vec: &mut [&mut IoVec]
) -> Poll<Result<usize>>
unsafe fn initializer(&self) -> Initializer
[src]
unsafe fn initializer(&self) -> Initializer
Determines if this AsyncRead
er can work with buffers of uninitialized memory. Read more
impl<'a> AsyncRead for &'a UnixStream
[src]
impl<'a> AsyncRead for &'a UnixStream
fn poll_read(&mut self, lw: &LocalWaker, buf: &mut [u8]) -> Poll<Result<usize>>
[src]
fn poll_read(&mut self, lw: &LocalWaker, buf: &mut [u8]) -> Poll<Result<usize>>
fn poll_vectored_read(
&mut self,
lw: &LocalWaker,
bufs: &mut [&mut IoVec]
) -> Poll<Result<usize>>
[src]
fn poll_vectored_read(
&mut self,
lw: &LocalWaker,
bufs: &mut [&mut IoVec]
) -> Poll<Result<usize>>
unsafe fn initializer(&self) -> Initializer
[src]
unsafe fn initializer(&self) -> Initializer
Determines if this AsyncRead
er can work with buffers of uninitialized memory. Read more
Auto Trait Implementations
impl Send for UnixStream
impl Send for UnixStream
impl Sync for UnixStream
impl Sync for UnixStream
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
[src]
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
fn flush(&mut self) -> Flush<Self>
[src]
fn flush(&mut self) -> Flush<Self>
Creates a future which will entirely flush this AsyncWrite
. Read more
fn close(&mut self) -> Close<Self>
[src]
fn close(&mut self) -> Close<Self>
Creates a future which will entirely close this AsyncWrite
.
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAll<'a, Self>
[src]
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAll<'a, Self>
Write data into this object. Read more
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
[src]
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
fn copy_into<W>(&'a mut self, writer: &'a mut W) -> CopyInto<'a, Self, W> where
W: AsyncWrite,
[src]
fn copy_into<W>(&'a mut self, writer: &'a mut W) -> CopyInto<'a, Self, W> where
W: AsyncWrite,
Creates a future which copies all the bytes from one object to another. Read more
fn read(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>
[src]
fn read(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>
Tries to read some bytes directly into the given buf
in asynchronous manner, returning a future type. Read more
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>
[src]
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>
Creates a future which will read exactly enough bytes to fill buf
, returning an error if end of file (EOF) is hit sooner. Read more
fn read_to_end(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>
[src]
fn read_to_end(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>
Creates a future which will read all the bytes from this AsyncRead
. Read more
fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>) where
Self: AsyncWrite,
[src]
fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>) where
Self: AsyncWrite,
Helper method for splitting this read/write object into two halves. Read more
impl<T> Erased for T
[src]
impl<T> Erased for T