[−][src]Struct tokio::net::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]
pub fn connect<P>(path: P) -> impl Future<Output = Result<UnixStream, Error>> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
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.
pub fn from_std(
stream: UnixStream,
handle: &Handle
) -> Result<UnixStream, Error>
[src]
stream: UnixStream,
handle: &Handle
) -> Result<UnixStream, Error>
Consumes a UnixStream
in the standard library and returns a
nonblocking UnixStream
from this crate.
The returned stream will be associated with the given event loop
specified by handle
and is ready to perform I/O.
pub fn pair() -> Result<(UnixStream, UnixStream), Error>
[src]
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 default event loop's handle.
pub fn local_addr(&self) -> Result<SocketAddr, Error>
[src]
Returns the socket address of the local half of this connection.
pub fn peer_addr(&self) -> Result<SocketAddr, Error>
[src]
Returns the socket address of the remote half of this connection.
pub fn peer_cred(&self) -> Result<UCred, Error>
[src]
Returns effective credentials of the process which called connect
or pair
.
pub fn take_error(&self) -> Result<Option<Error>, Error>
[src]
Returns the value of the SO_ERROR
option.
pub fn shutdown(&self, how: Shutdown) -> Result<(), Error>
[src]
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
).
pub fn split(self) -> (UnixStreamReadHalf, UnixStreamWriteHalf)
[src]
Split a UnixStream
into a read half and a write half, which can be used
to read and write the stream concurrently.
See the module level documenation of split
for more
details.
pub fn split_mut(&mut self) -> (UnixStreamReadHalfMut, UnixStreamWriteHalfMut)
[src]
Split a UnixStream
into a read half and a write half, which can be used
to read and write the stream concurrently.
See the module level documenation of split
for more
details.
Trait Implementations
impl Debug for UnixStream
[src]
impl<'_> AsRef<UnixStream> for UnixStreamWriteHalfMut<'_>
[src]
fn as_ref(&self) -> &UnixStream
[src]
impl AsRef<UnixStream> for UnixStreamReadHalf
[src]
fn as_ref(&self) -> &UnixStream
[src]
impl AsRef<UnixStream> for UnixStreamWriteHalf
[src]
fn as_ref(&self) -> &UnixStream
[src]
impl<'_> AsRef<UnixStream> for UnixStreamReadHalfMut<'_>
[src]
fn as_ref(&self) -> &UnixStream
[src]
impl AsyncRead for UnixStream
[src]
unsafe fn prepare_uninitialized_buffer(&self, &mut [u8]) -> bool
[src]
fn poll_read(
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize, Error>>
[src]
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &mut [u8]
) -> Poll<Result<usize, Error>>
fn poll_read_buf<B>(
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: BufMut,
[src]
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: BufMut,
impl TryFrom<UnixStream> for UnixStream
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(stream: UnixStream) -> Result<UnixStream, Error>
[src]
Consumes stream, returning the tokio I/O object.
This is equivalent to
UnixStream::from_std(stream, &Handle::default())
.
impl AsyncWrite for UnixStream
[src]
fn poll_write(
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize, Error>>
[src]
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &[u8]
) -> Poll<Result<usize, Error>>
fn poll_flush(
self: Pin<&mut UnixStream>,
&mut Context
) -> Poll<Result<(), Error>>
[src]
self: Pin<&mut UnixStream>,
&mut Context
) -> Poll<Result<(), Error>>
fn poll_shutdown(
self: Pin<&mut UnixStream>,
&mut Context
) -> Poll<Result<(), Error>>
[src]
self: Pin<&mut UnixStream>,
&mut Context
) -> Poll<Result<(), Error>>
fn poll_write_buf<B>(
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: Buf,
[src]
self: Pin<&mut UnixStream>,
cx: &mut Context,
buf: &mut B
) -> Poll<Result<usize, Error>> where
B: Buf,
impl AsRawFd for UnixStream
[src]
Auto Trait Implementations
impl Unpin for UnixStream
impl Send for UnixStream
impl Sync for UnixStream
impl !RefUnwindSafe for UnixStream
impl !UnwindSafe for UnixStream
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Ffn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
[src]
R: AsyncRead + ?Sized,
fn copy<W>(&'a mut self, dst: &'a mut W) -> Copy<'a, Self, W> where
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized,
[src]
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized,
Copy all data from self
into the provided AsyncWrite
. Read more
fn read(&'a mut self, dst: &'a mut [u8]) -> Read<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
Read data into the provided buffer. Read more
fn read_exact(&'a mut self, dst: &'a mut [u8]) -> ReadExact<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
Read exactly the amount of data needed to fill the provided buffer.
fn read_to_end(&'a mut self, dst: &'a mut Vec<u8>) -> ReadToEnd<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
Read all bytes until EOF in this source, placing them into dst
. Read more
fn read_to_string(&'a mut self, dst: &'a mut String) -> ReadToString<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
Read all bytes until EOF in this source, placing them into dst
. Read more
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
[src]
W: AsyncWrite + ?Sized,
fn write(&'a mut self, src: &'a [u8]) -> Write<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
Write a buffer into this writter, returning how many bytes were written.
fn write_all(&'a mut self, src: &'a [u8]) -> WriteAll<'a, Self> where
Self: Unpin,
[src]
Self: Unpin,
Attempt to write an entire buffer into this writter.
fn flush(&mut self) -> Flush<Self> where
Self: Unpin,
[src]
Self: Unpin,
Flush the contents of this writer.
fn shutdown(&mut self) -> Shutdown<Self> where
Self: Unpin,
[src]
Self: Unpin,
Shutdown this writer.