pub struct StreamTransport<Stream> { /* private fields */ }
Expand description

Transport layer for byte-stream sockets.

Implementations§

source§

impl<Stream> StreamTransport<Stream>
where Self: Transport,

source

pub fn new(stream: Stream, config: StreamConfig) -> Self

Create a new transport with custom configuration.

source

pub fn new_default(stream: Stream) -> Self

Create a new transport using the default configuration.

source

pub fn stream(&self) -> &Stream

Get direct access to the underlying stream.

source

pub fn stream_mut(&mut self) -> &Stream

Get direct mutable access to the underlying stream.

source

pub fn into_stream(self) -> Stream

Consume the stream transport to retrieve the underlying stream.

Trait Implementations§

source§

impl<'a, Address> Connect<'a, Address> for StreamTransport<TcpStream>
where Address: ToSocketAddrs + 'a,

§

type Future = Pin<Box<dyn Future<Output = Result<StreamTransport<TcpStream>, Error>> + 'a>>

The type of the future returned by Self::connect.
source§

fn connect(address: Address, config: Self::Config) -> Self::Future

Create a new transport connected to a remote address.
source§

impl<'a, Address> Connect<'a, Address> for StreamTransport<UnixStream>
where Address: AsRef<Path> + 'a,

§

type Future = Pin<Box<dyn Future<Output = Result<StreamTransport<UnixStream>, Error>> + 'a>>

The type of the future returned by Self::connect.
source§

fn connect(address: Address, config: Self::Config) -> Self::Future

Create a new transport connected to a remote address.
source§

impl Transport for StreamTransport<TcpStream>

§

type Body = StreamBody

The body type for the messages.
§

type Info = TcpStreamInfo

Information about the underlying stream or connection of the transport.
§

type Config = StreamConfig

The configuration type for the transport.
§

type ReadHalf<'a> = StreamReadHalf<ReadHalf<'a>>

The type of the read half of the transport.
§

type WriteHalf<'a> = StreamWriteHalf<WriteHalf<'a>>

The type of the write half of the transport.
source§

fn split( &mut self ) -> (StreamReadHalf<ReadHalf<'_>>, StreamWriteHalf<WriteHalf<'_>>)

Split the transport into a read half and a write half.
source§

fn info(&self) -> Result<Self::Info>

Get information about the peer on the other end of the transport. Read more
source§

impl Transport for StreamTransport<UnixStream>

§

type Body = StreamBody

The body type for the messages.
§

type Info = UnixStreamInfo

Information about the underlying stream or connection of the transport.
§

type Config = StreamConfig

The configuration type for the transport.
§

type ReadHalf<'a> = StreamReadHalf<ReadHalf<'a>>

The type of the read half of the transport.
§

type WriteHalf<'a> = StreamWriteHalf<WriteHalf<'a>>

The type of the write half of the transport.
source§

fn split( &mut self ) -> (StreamReadHalf<ReadHalf<'_>>, StreamWriteHalf<WriteHalf<'_>>)

Split the transport into a read half and a write half.
source§

fn info(&self) -> Result<Self::Info>

Get information about the peer on the other end of the transport. Read more

Auto Trait Implementations§

§

impl<Stream> RefUnwindSafe for StreamTransport<Stream>
where Stream: RefUnwindSafe,

§

impl<Stream> Send for StreamTransport<Stream>
where Stream: Send,

§

impl<Stream> Sync for StreamTransport<Stream>
where Stream: Sync,

§

impl<Stream> Unpin for StreamTransport<Stream>
where Stream: Unpin,

§

impl<Stream> UnwindSafe for StreamTransport<Stream>
where Stream: UnwindSafe,

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
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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.