pub struct Socket(/* private fields */);
Expand description
A socket in a remote FDomain.
Implementations§
Source§impl Socket
impl Socket
Sourcepub fn read<'a>(
&self,
buf: &'a mut [u8],
) -> impl Future<Output = Result<usize, Error>> + 'a
pub fn read<'a>( &self, buf: &'a mut [u8], ) -> impl Future<Output = Result<usize, Error>> + 'a
Read up to the given buffer’s length from the socket.
Sourcepub fn write_all(&self, bytes: &[u8]) -> impl Future<Output = Result<(), Error>>
pub fn write_all(&self, bytes: &[u8]) -> impl Future<Output = Result<(), Error>>
Write all of the given data to the socket.
Sourcepub fn set_socket_disposition(
&self,
disposition: Option<SocketDisposition>,
disposition_peer: Option<SocketDisposition>,
) -> impl Future<Output = Result<(), Error>>
pub fn set_socket_disposition( &self, disposition: Option<SocketDisposition>, disposition_peer: Option<SocketDisposition>, ) -> impl Future<Output = Result<(), Error>>
Set the disposition of this socket and/or its peer.
Sourcepub fn stream(self) -> Result<(SocketReadStream, SocketWriter), Error>
pub fn stream(self) -> Result<(SocketReadStream, SocketWriter), Error>
Split this socket into a streaming reader and a writer. This is more efficient on the read side if you intend to consume all of the data from the socket. However it will prevent you from transferring the handle in the future. It also means data will build up in the buffer, so it may lead to memory issues if you don’t intend to use the data from the socket as fast as it comes.
Trait Implementations§
Source§impl AsHandleRef for Socket
impl AsHandleRef for Socket
Source§impl AsyncRead for Socket
impl AsyncRead for Socket
Source§impl AsyncWrite for Socket
impl AsyncWrite for Socket
Source§fn poll_write(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
Attempt to write bytes from
buf
into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
Source§impl EncodableAsHandle for Socket
impl EncodableAsHandle for Socket
Source§type Dialect = FDomainResourceDialect
type Dialect = FDomainResourceDialect
What resource dialect can encode this object as a handle.
Source§impl HandleBased for Socket
impl HandleBased for Socket
Source§fn close(self) -> impl Future<Output = Result<(), Error>>
fn close(self) -> impl Future<Output = Result<(), Error>>
Closes this handle. Surfaces errors that dropping the handle will not.
Source§fn duplicate_handle(
&self,
rights: Rights,
) -> impl Future<Output = Result<Self, Error>>
fn duplicate_handle( &self, rights: Rights, ) -> impl Future<Output = Result<Self, Error>>
Duplicate this handle.
Source§fn replace_handle(
self,
rights: Rights,
) -> impl Future<Output = Result<Self, Error>>
fn replace_handle( self, rights: Rights, ) -> impl Future<Output = Result<Self, Error>>
Replace this handle with an equivalent one with different rights.
Source§fn into_handle(self) -> Handle
fn into_handle(self) -> Handle
Convert this handle-based value into a pure
Handle
.Source§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
Construct a new handle-based value from a
Handle
.Source§fn into_handle_based<H: HandleBased>(self) -> H
fn into_handle_based<H: HandleBased>(self) -> H
Turn this handle-based value into one of a different type.
Source§fn from_handle_based<H: HandleBased>(h: H) -> Self
fn from_handle_based<H: HandleBased>(h: H) -> Self
Turn another handle-based type into this one.
Source§impl Ord for Socket
impl Ord for Socket
Source§impl PartialOrd for Socket
impl PartialOrd for Socket
impl Eq for Socket
impl StructuralPartialEq for Socket
Auto Trait Implementations§
impl Freeze for Socket
impl RefUnwindSafe for Socket
impl Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl UnwindSafe for Socket
Blanket Implementations§
§impl<R> AsyncReadExt for Rwhere
R: AsyncRead + ?Sized,
impl<R> AsyncReadExt for Rwhere
R: AsyncRead + ?Sized,
§fn chain<R>(self, next: R) -> Chain<Self, R>where
Self: Sized,
R: AsyncRead,
fn chain<R>(self, next: R) -> Chain<Self, R>where
Self: Sized,
R: AsyncRead,
Creates an adaptor which will chain this stream with another. Read more
§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
Tries to read some bytes directly into the given
buf
in asynchronous
manner, returning a future type. Read more§fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectored<'a, Self>where
Self: Unpin,
Creates a future which will read from the
AsyncRead
into bufs
using vectored
IO operations. Read more§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
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>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
Creates a future which will read all the bytes from this
AsyncRead
. Read more§fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToString<'a, Self>where
Self: Unpin,
Creates a future which will read all the bytes from this
AsyncRead
. Read more§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
§fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
Creates a future which will entirely flush this
AsyncWrite
. Read more§fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
Creates a future which will entirely close this
AsyncWrite
.§fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
Creates a future which will write bytes from
buf
into the object. Read more§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
Creates a future which will write bytes from
bufs
into the object using vectored
IO operations. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more