Skip to main content

TcpStream

Struct TcpStream 

pub struct TcpStream { /* private fields */ }
Available on crate feature net only.
Expand description

A TCP stream between a local and a remote socket.

A TCP stream can either be created by connecting to an endpoint, via the connect method, or by accepting a connection from a listener.

§Examples

use std::net::SocketAddr;

use compio_io::AsyncWrite;
use compio_net::TcpStream;

// Connect to a peer
let mut stream = TcpStream::connect("127.0.0.1:8080").await.unwrap();

// Write some data.
stream.write("hello world!").await.unwrap();

Implementations§

§

impl TcpStream

pub async fn connect(addr: impl ToSocketAddrsAsync) -> Result<TcpStream, Error>

Opens a TCP connection to a remote host.

To configure the socket before connecting, you can use the TcpSocket type.

pub fn from_std(stream: TcpStream) -> Result<TcpStream, Error>

Creates new TcpStream from a std::net::TcpStream.

pub fn close(self) -> impl Future<Output = Result<(), Error>>

Close the socket. If the returned future is dropped before polling, the socket won’t be closed.

As the socket is clonable, users can call close on a clone, but the future will never complete until all clones are dropped. Some operations may keep a strong reference to the socket, so the future may never complete if there are pending operations.

It’s OK to drop the socket directly without calling close, but the socket may not be closed immediately.

pub fn peer_addr(&self) -> Result<SocketAddr, Error>

Returns the socket address of the remote peer of this TCP connection.

pub fn local_addr(&self) -> Result<SocketAddr, Error>

Returns the socket address of the local half of this TCP connection.

pub fn take_error(&self) -> Result<Option<Error>, Error>

Returns the value of the SO_ERROR option.

pub fn split(&self) -> (ReadHalf<'_, TcpStream>, WriteHalf<'_, TcpStream>)

Splits a TcpStream into a read half and a write half, which can be used to read and write the stream concurrently.

This method is more efficient than into_split, but the halves cannot be moved into independently spawned tasks.

pub fn into_split(self) -> (TcpStream, TcpStream)

Splits a TcpStream into a read half and a write half, which can be used to read and write the stream concurrently.

Unlike split, the owned halves can be moved to separate tasks.

pub fn to_poll_fd(&self) -> Result<PollFd<Socket>, Error>

Create PollFd from inner socket.

pub fn into_poll_fd(self) -> Result<PollFd<Socket>, Error>

Create PollFd from inner socket.

pub fn nodelay(&self) -> Result<bool, Error>

Gets the value of the TCP_NODELAY option on this socket.

For more information about this option, see TcpStream::set_nodelay.

pub fn set_nodelay(&self, nodelay: bool) -> Result<(), Error>

Sets the value of the TCP_NODELAY option on this socket.

If set, this option disables the Nagle algorithm. This means that segments are always sent as soon as possible, even if there is only a small amount of data. When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets.

pub fn linger(&self) -> Result<Option<Duration>, Error>

Reads the linger duration for this socket by getting the SO_LINGER option.

pub fn set_zero_linger(&self) -> Result<(), Error>

Sets a linger duration of zero on this socket by setting the SO_LINGER option.

pub fn ttl_v4(&self) -> Result<u32, Error>

Gets the value of the IP_TTL option for this socket.

For more information about this option, see set_ttl_v4.

pub fn set_ttl_v4(&self, ttl: u32) -> Result<(), Error>

Sets the value for the IP_TTL option on this socket.

This value sets the time-to-live field that is used in every packet sent from this socket.

pub async fn send_out_of_band<T>(&self, buf: T) -> BufResult<usize, T>
where T: IoBuf,

Sends out-of-band data on this socket.

Out-of-band data is sent with the MSG_OOB flag.

Trait Implementations§

§

impl AsFd for TcpStream

Available on Unix only.
§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
§

impl AsRawFd for TcpStream

§

fn as_raw_fd(&self) -> i32

Extracts the raw file descriptor. Read more
§

impl AsyncRead for &TcpStream

§

async fn read<B>(&mut self, buf: B) -> BufResult<usize, B>
where B: IoBufMut,

Read some bytes from this source into the IoBufMut buffer and return a BufResult, consisting of the buffer and a usize indicating how many bytes were read. Read more
§

async fn read_vectored<V>(&mut self, buf: V) -> BufResult<usize, V>

Like read, except that it reads into a type implements IoVectoredBufMut. Read more
§

impl AsyncRead for TcpStream

§

async fn read<B>(&mut self, buf: B) -> BufResult<usize, B>
where B: IoBufMut,

Read some bytes from this source into the IoBufMut buffer and return a BufResult, consisting of the buffer and a usize indicating how many bytes were read. Read more
§

async fn read_vectored<V>(&mut self, buf: V) -> BufResult<usize, V>

Like read, except that it reads into a type implements IoVectoredBufMut. Read more
§

impl AsyncReadAncillary for &TcpStream

§

async fn read_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<(usize, usize), (T, C)>
where T: IoBufMut, C: IoBufMut,

Read data with ancillary data into an owned buffer.
§

async fn read_vectored_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<(usize, usize), (T, C)>

Read data with ancillary data into a vectored buffer.
§

impl AsyncReadAncillary for TcpStream

§

async fn read_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<(usize, usize), (T, C)>
where T: IoBufMut, C: IoBufMut,

Read data with ancillary data into an owned buffer.
§

async fn read_vectored_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<(usize, usize), (T, C)>

Read data with ancillary data into a vectored buffer.
§

impl AsyncReadAncillaryManaged for &TcpStream

§

async fn read_managed_with_ancillary<C>( &mut self, len: usize, control: C, ) -> Result<Option<(<&TcpStream as AsyncReadManaged>::Buffer, C)>, Error>
where C: IoBufMut,

Read data into a managed buffer with ancillary data. Read more
§

impl AsyncReadAncillaryManaged for TcpStream

§

async fn read_managed_with_ancillary<C>( &mut self, len: usize, control: C, ) -> Result<Option<(<TcpStream as AsyncReadManaged>::Buffer, C)>, Error>
where C: IoBufMut,

Read data into a managed buffer with ancillary data. Read more
§

impl AsyncReadAncillaryMulti for &TcpStream

§

type Return = RecvMsgMultiResult

A wrapped type for the payload data and the ancillary data.
§

fn read_multi_with_ancillary( &mut self, control_len: usize, ) -> impl Stream<Item = Result<<&TcpStream as AsyncReadAncillaryMulti>::Return, Error>>

Read data and ancillary data into multiple managed buffers.
§

impl AsyncReadAncillaryMulti for TcpStream

§

type Return = RecvMsgMultiResult

A wrapped type for the payload data and the ancillary data.
§

fn read_multi_with_ancillary( &mut self, control_len: usize, ) -> impl Stream<Item = Result<<TcpStream as AsyncReadAncillaryMulti>::Return, Error>>

Read data and ancillary data into multiple managed buffers.
§

impl AsyncReadManaged for &TcpStream

§

type Buffer = BufferRef

Filled buffer type
§

async fn read_managed( &mut self, len: usize, ) -> Result<Option<<&TcpStream as AsyncReadManaged>::Buffer>, Error>

Read some bytes from this source and return a Self::Buffer. Read more
§

impl AsyncReadManaged for TcpStream

§

type Buffer = BufferRef

Filled buffer type
§

async fn read_managed( &mut self, len: usize, ) -> Result<Option<<TcpStream as AsyncReadManaged>::Buffer>, Error>

Read some bytes from this source and return a Self::Buffer. Read more
§

impl AsyncReadMulti for &TcpStream

§

fn read_multi( &mut self, len: usize, ) -> impl Stream<Item = Result<<&TcpStream as AsyncReadManaged>::Buffer, Error>>

Read some bytes from this source and return a stream of AsyncReadManaged::Buffer. Read more
§

impl AsyncReadMulti for TcpStream

§

fn read_multi( &mut self, len: usize, ) -> impl Stream<Item = Result<<TcpStream as AsyncReadManaged>::Buffer, Error>>

Read some bytes from this source and return a stream of AsyncReadManaged::Buffer. Read more
§

impl AsyncWrite for &TcpStream

§

async fn write<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBuf,

Write some bytes from the buffer into this source and return a BufResult, consisting of the buffer and a usize indicating how many bytes were written.
§

async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoVectoredBuf,

Like write, except that it write bytes from a buffer implements IoVectoredBuf into the source. Read more
§

async fn flush(&mut self) -> Result<(), Error>

Attempts to flush the object, ensuring that any buffered data reach their destination.
§

async fn shutdown(&mut self) -> Result<(), Error>

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down.
§

impl AsyncWrite for TcpStream

§

async fn write<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBuf,

Write some bytes from the buffer into this source and return a BufResult, consisting of the buffer and a usize indicating how many bytes were written.
§

async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoVectoredBuf,

Like write, except that it write bytes from a buffer implements IoVectoredBuf into the source. Read more
§

async fn flush(&mut self) -> Result<(), Error>

Attempts to flush the object, ensuring that any buffered data reach their destination.
§

async fn shutdown(&mut self) -> Result<(), Error>

Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down.
§

impl AsyncWriteAncillary for &TcpStream

§

async fn write_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<usize, (T, C)>
where T: IoBuf, C: IoBuf,

Write data with ancillary data from an owned buffer.
§

async fn write_vectored_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<usize, (T, C)>
where T: IoVectoredBuf, C: IoBuf,

Write data with ancillary data from a vectored buffer.
§

impl AsyncWriteAncillary for TcpStream

§

async fn write_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<usize, (T, C)>
where T: IoBuf, C: IoBuf,

Write data with ancillary data from an owned buffer.
§

async fn write_vectored_with_ancillary<T, C>( &mut self, buffer: T, control: C, ) -> BufResult<usize, (T, C)>
where T: IoVectoredBuf, C: IoBuf,

Write data with ancillary data from a vectored buffer.
§

impl AsyncWriteAncillaryZerocopy for &TcpStream

§

type BufferReadyFuture<T: IoBuf, C: IoBuf> = Extract<Zerocopy<SendMsg<[T; 1], C, SharedFd<Socket>>>, T, C>

The future that will be resolved when the buffer is safe to be reused.
§

type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf> = Zerocopy<SendMsg<T, C, SharedFd<Socket>>>

The future that will be resolved when the vectored buffer is safe to be reused.
§

async fn write_zerocopy_with_ancillary<T, C>( &mut self, buf: T, control: C, ) -> BufResult<usize, <&TcpStream as AsyncWriteAncillaryZerocopy>::BufferReadyFuture<T, C>>
where T: IoBuf, C: IoBuf,

Write some bytes from buffer into this source using the underlying zero-copy mechanism. It returns a result of the underlying write operation and a future that will be resolved when the buffer is safe to be reused.
§

async fn write_zerocopy_vectored_with_ancillary<T, C>( &mut self, buf: T, control: C, ) -> BufResult<usize, <&TcpStream as AsyncWriteAncillaryZerocopy>::VectoredBufferReadyFuture<T, C>>
where T: IoVectoredBuf, C: IoBuf,

Like write_zerocopy_with_ancillary, except that it writes from a buffer implements IoVectoredBuf into the source.
§

impl AsyncWriteAncillaryZerocopy for TcpStream

§

type BufferReadyFuture<T: IoBuf, C: IoBuf> = Extract<Zerocopy<SendMsg<[T; 1], C, SharedFd<Socket>>>, T, C>

The future that will be resolved when the buffer is safe to be reused.
§

type VectoredBufferReadyFuture<T: IoVectoredBuf, C: IoBuf> = Zerocopy<SendMsg<T, C, SharedFd<Socket>>>

The future that will be resolved when the vectored buffer is safe to be reused.
§

async fn write_zerocopy_with_ancillary<T, C>( &mut self, buf: T, control: C, ) -> BufResult<usize, <TcpStream as AsyncWriteAncillaryZerocopy>::BufferReadyFuture<T, C>>
where T: IoBuf, C: IoBuf,

Write some bytes from buffer into this source using the underlying zero-copy mechanism. It returns a result of the underlying write operation and a future that will be resolved when the buffer is safe to be reused.
§

async fn write_zerocopy_vectored_with_ancillary<T, C>( &mut self, buf: T, control: C, ) -> BufResult<usize, <TcpStream as AsyncWriteAncillaryZerocopy>::VectoredBufferReadyFuture<T, C>>
where T: IoVectoredBuf, C: IoBuf,

Like write_zerocopy_with_ancillary, except that it writes from a buffer implements IoVectoredBuf into the source.
§

impl AsyncWriteZerocopy for &TcpStream

§

type BufferReadyFuture<T: IoBuf> = Zerocopy<Send<T, SharedFd<Socket>>>

The future that will be resolved when the buffer is safe to be reused.
§

type VectoredBufferReadyFuture<T: IoVectoredBuf> = Zerocopy<SendVectored<T, SharedFd<Socket>>>

The future that will be resolved when the vectored buffer is safe to be reused.
§

async fn write_zerocopy<T>( &mut self, buf: T, ) -> BufResult<usize, <&TcpStream as AsyncWriteZerocopy>::BufferReadyFuture<T>>
where T: IoBuf,

Write some bytes from buffer into this source using the underlying zero-copy mechanism. It returns a result of the underlying write operation and a future that will be resolved when the buffer is safe to be reused.
§

async fn write_zerocopy_vectored<T>( &mut self, buf: T, ) -> BufResult<usize, <&TcpStream as AsyncWriteZerocopy>::VectoredBufferReadyFuture<T>>
where T: IoVectoredBuf,

Like write_zerocopy, except that it writes from a buffer implements IoVectoredBuf into the source.
§

impl AsyncWriteZerocopy for TcpStream

§

type BufferReadyFuture<T: IoBuf> = Zerocopy<Send<T, SharedFd<Socket>>>

The future that will be resolved when the buffer is safe to be reused.
§

type VectoredBufferReadyFuture<T: IoVectoredBuf> = Zerocopy<SendVectored<T, SharedFd<Socket>>>

The future that will be resolved when the vectored buffer is safe to be reused.
§

async fn write_zerocopy<T>( &mut self, buf: T, ) -> BufResult<usize, <TcpStream as AsyncWriteZerocopy>::BufferReadyFuture<T>>
where T: IoBuf,

Write some bytes from buffer into this source using the underlying zero-copy mechanism. It returns a result of the underlying write operation and a future that will be resolved when the buffer is safe to be reused.
§

async fn write_zerocopy_vectored<T>( &mut self, buf: T, ) -> BufResult<usize, <TcpStream as AsyncWriteZerocopy>::VectoredBufferReadyFuture<T>>
where T: IoVectoredBuf,

Like write_zerocopy, except that it writes from a buffer implements IoVectoredBuf into the source.
§

impl Clone for TcpStream

§

fn clone(&self) -> TcpStream

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for TcpStream

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl FromRawFd for TcpStream

Available on Unix only.
§

unsafe fn from_raw_fd(fd: i32) -> TcpStream

Constructs a new instance of Self from the given raw file descriptor. Read more
§

impl<'a> Splittable for &'a TcpStream

§

type ReadHalf = ReadHalf<'a, TcpStream>

The type of the read half, which normally implements AsyncRead or AsyncReadAt.
§

type WriteHalf = WriteHalf<'a, TcpStream>

The type of the write half, which normally implements AsyncWrite or AsyncWriteAt.
§

fn split( self, ) -> (<&'a TcpStream as Splittable>::ReadHalf, <&'a TcpStream as Splittable>::WriteHalf)

Consumes self and returns a tuple containing separate read and write halves. Read more
§

impl<'a> Splittable for &'a mut TcpStream

§

type ReadHalf = ReadHalf<'a, TcpStream>

The type of the read half, which normally implements AsyncRead or AsyncReadAt.
§

type WriteHalf = WriteHalf<'a, TcpStream>

The type of the write half, which normally implements AsyncWrite or AsyncWriteAt.
§

fn split( self, ) -> (<&'a mut TcpStream as Splittable>::ReadHalf, <&'a mut TcpStream as Splittable>::WriteHalf)

Consumes self and returns a tuple containing separate read and write halves. Read more
§

impl Splittable for TcpStream

§

type ReadHalf = TcpStream

The type of the read half, which normally implements AsyncRead or AsyncReadAt.
§

type WriteHalf = TcpStream

The type of the write half, which normally implements AsyncWrite or AsyncWriteAt.
§

fn split( self, ) -> (<TcpStream as Splittable>::ReadHalf, <TcpStream as Splittable>::WriteHalf)

Consumes self and returns a tuple containing separate read and write halves. Read more
§

impl ToSharedFd<Socket> for TcpStream

§

fn to_shared_fd(&self) -> SharedFd<Socket>

Return a cloned SharedFd.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsSource for T
where T: AsFd,

§

fn source(&self) -> BorrowedFd<'_>

Returns the borrowed file descriptor.
§

impl<A> AsyncReadExt for A
where A: AsyncRead + ?Sized,

§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of AsyncRead. Read more
§

async fn append<T>(&mut self, buf: T) -> BufResult<usize, T>
where T: IoBufMut,

Same as AsyncRead::read, but it appends data to the end of the buffer; in other words, it read to the beginning of the uninitialized area.
§

async fn read_exact<T>(&mut self, buf: T) -> BufResult<(), T>
where T: IoBufMut,

Read the exact number of bytes required to fill the buf.
§

async fn read_to_string(&mut self, buf: String) -> BufResult<usize, String>

Read all bytes as String until underlying reader reaches EOF.
§

async fn read_to_end<A>( &mut self, buf: Vec<u8, A>, ) -> BufResult<usize, Vec<u8, A>>
where A: Allocator + 'static,

Read all bytes until underlying reader reaches EOF.
§

async fn read_vectored_exact<T>(&mut self, buf: T) -> BufResult<(), T>

Read the exact number of bytes required to fill the vectored buf.
§

fn framed<T, C, F>( self, codec: C, framer: F, ) -> Framed<Self::ReadHalf, Self::WriteHalf, C, F, T, T>
where Self: Sized + Splittable,

Create a framed::Framed reader/writer with the given codec and framer.
§

fn bytes( self, ) -> Framed<Self::ReadHalf, Self::WriteHalf, BytesCodec, NoopFramer, Bytes, Bytes>
where Self: Sized + Splittable,

Available on crate feature bytes only.
Convenience method to create a framed::BytesFramed reader/writter out of a splittable.
§

fn read_only(self) -> ReadOnly<Self>
where Self: Sized,

Create a Splittable that uses Self as ReadHalf and () as WriteHalf. Read more
§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adaptor which reads at most limit bytes from it. Read more
§

async fn read_u8(&mut self) -> Result<u8, Error>

Read a big endian u8 from the underlying reader.
§

async fn read_u8_le(&mut self) -> Result<u8, Error>

Read a little endian u8 from the underlying reader.
§

async fn read_u16(&mut self) -> Result<u16, Error>

Read a big endian u16 from the underlying reader.
§

async fn read_u16_le(&mut self) -> Result<u16, Error>

Read a little endian u16 from the underlying reader.
§

async fn read_u32(&mut self) -> Result<u32, Error>

Read a big endian u32 from the underlying reader.
§

async fn read_u32_le(&mut self) -> Result<u32, Error>

Read a little endian u32 from the underlying reader.
§

async fn read_u64(&mut self) -> Result<u64, Error>

Read a big endian u64 from the underlying reader.
§

async fn read_u64_le(&mut self) -> Result<u64, Error>

Read a little endian u64 from the underlying reader.
§

async fn read_u128(&mut self) -> Result<u128, Error>

Read a big endian u128 from the underlying reader.
§

async fn read_u128_le(&mut self) -> Result<u128, Error>

Read a little endian u128 from the underlying reader.
§

async fn read_i8(&mut self) -> Result<i8, Error>

Read a big endian i8 from the underlying reader.
§

async fn read_i8_le(&mut self) -> Result<i8, Error>

Read a little endian i8 from the underlying reader.
§

async fn read_i16(&mut self) -> Result<i16, Error>

Read a big endian i16 from the underlying reader.
§

async fn read_i16_le(&mut self) -> Result<i16, Error>

Read a little endian i16 from the underlying reader.
§

async fn read_i32(&mut self) -> Result<i32, Error>

Read a big endian i32 from the underlying reader.
§

async fn read_i32_le(&mut self) -> Result<i32, Error>

Read a little endian i32 from the underlying reader.
§

async fn read_i64(&mut self) -> Result<i64, Error>

Read a big endian i64 from the underlying reader.
§

async fn read_i64_le(&mut self) -> Result<i64, Error>

Read a little endian i64 from the underlying reader.
§

async fn read_i128(&mut self) -> Result<i128, Error>

Read a big endian i128 from the underlying reader.
§

async fn read_i128_le(&mut self) -> Result<i128, Error>

Read a little endian i128 from the underlying reader.
§

async fn read_f32(&mut self) -> Result<f32, Error>

Read a big endian f32 from the underlying reader.
§

async fn read_f32_le(&mut self) -> Result<f32, Error>

Read a little endian f32 from the underlying reader.
§

async fn read_f64(&mut self) -> Result<f64, Error>

Read a big endian f64 from the underlying reader.
§

async fn read_f64_le(&mut self) -> Result<f64, Error>

Read a little endian f64 from the underlying reader.
§

impl<A> AsyncWriteExt for A
where A: AsyncWrite + ?Sized,

§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adaptor for this instance of AsyncWrite. Read more
§

async fn write_all<T>(&mut self, buf: T) -> BufResult<(), T>
where T: IoBuf,

Write the entire contents of a buffer into this writer.
§

async fn write_vectored_all<T>(&mut self, buf: T) -> BufResult<(), T>
where T: IoVectoredBuf,

Write the entire contents of a buffer into this writer. Like AsyncWrite::write_vectored, except that it tries to write the entire contents of the buffer into this writer.
§

fn framed<T, C, F>( self, codec: C, framer: F, ) -> Framed<Self::ReadHalf, Self::WriteHalf, C, F, T, T>
where Self: Sized + Splittable,

Create a framed::Framed reader/writer with the given codec and framer.
§

fn bytes( self, ) -> Framed<Self::ReadHalf, Self::WriteHalf, BytesCodec, NoopFramer, Bytes, Bytes>
where Self: Sized + Splittable,

Available on crate feature bytes only.
Convenience method to create a framed::BytesFramed reader/writer out of a splittable.
§

fn write_only(self) -> WriteOnly<Self>
where Self: Sized,

Create a Splittable that uses Self as WriteHalf and () as ReadHalf. Read more
§

async fn write_u8(&mut self, num: u8) -> Result<(), Error>

Write a big endian u8 into the underlying writer.
§

async fn write_u8_le(&mut self, num: u8) -> Result<(), Error>

Write a little endian u8 into the underlying writer.
§

async fn write_u16(&mut self, num: u16) -> Result<(), Error>

Write a big endian u16 into the underlying writer.
§

async fn write_u16_le(&mut self, num: u16) -> Result<(), Error>

Write a little endian u16 into the underlying writer.
§

async fn write_u32(&mut self, num: u32) -> Result<(), Error>

Write a big endian u32 into the underlying writer.
§

async fn write_u32_le(&mut self, num: u32) -> Result<(), Error>

Write a little endian u32 into the underlying writer.
§

async fn write_u64(&mut self, num: u64) -> Result<(), Error>

Write a big endian u64 into the underlying writer.
§

async fn write_u64_le(&mut self, num: u64) -> Result<(), Error>

Write a little endian u64 into the underlying writer.
§

async fn write_u128(&mut self, num: u128) -> Result<(), Error>

Write a big endian u128 into the underlying writer.
§

async fn write_u128_le(&mut self, num: u128) -> Result<(), Error>

Write a little endian u128 into the underlying writer.
§

async fn write_i8(&mut self, num: i8) -> Result<(), Error>

Write a big endian i8 into the underlying writer.
§

async fn write_i8_le(&mut self, num: i8) -> Result<(), Error>

Write a little endian i8 into the underlying writer.
§

async fn write_i16(&mut self, num: i16) -> Result<(), Error>

Write a big endian i16 into the underlying writer.
§

async fn write_i16_le(&mut self, num: i16) -> Result<(), Error>

Write a little endian i16 into the underlying writer.
§

async fn write_i32(&mut self, num: i32) -> Result<(), Error>

Write a big endian i32 into the underlying writer.
§

async fn write_i32_le(&mut self, num: i32) -> Result<(), Error>

Write a little endian i32 into the underlying writer.
§

async fn write_i64(&mut self, num: i64) -> Result<(), Error>

Write a big endian i64 into the underlying writer.
§

async fn write_i64_le(&mut self, num: i64) -> Result<(), Error>

Write a little endian i64 into the underlying writer.
§

async fn write_i128(&mut self, num: i128) -> Result<(), Error>

Write a big endian i128 into the underlying writer.
§

async fn write_i128_le(&mut self, num: i128) -> Result<(), Error>

Write a little endian i128 into the underlying writer.
§

async fn write_f32(&mut self, num: f32) -> Result<(), Error>

Write a big endian f32 into the underlying writer.
§

async fn write_f32_le(&mut self, num: f32) -> Result<(), Error>

Write a little endian f32 into the underlying writer.
§

async fn write_f64(&mut self, num: f64) -> Result<(), Error>

Write a big endian f64 into the underlying writer.
§

async fn write_f64_le(&mut self, num: f64) -> Result<(), Error>

Write a little endian f64 into the underlying writer.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<S> IntoMaybeTlsStream<S> for S
where S: Splittable,

Source§

fn into_maybe_tls_stream( self, capacity: usize, max_buffer_size: usize, ) -> MaybeTlsStream<S>

Create MaybeTlsStream with capacity and buffer size limit.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Ungil for T
where T: Send,