pub struct Stream { /* private fields */ }
Expand description
A network stream.
Stream
provides an abstraction over connectionless and connection-oriented network sockets. In many cases, it is
not required to know the exact socket family (e.g. TCP, UDP, Unix domain socket) that is being used, and it can be
beneficial to allow abstracting over the differences to facilitate simpler code.
§Connection-oriented mode
In connection-oriented mode, the stream is backed by a socket that operates in a connection-oriented manner, which ensures a reliable, ordered stream of messages to and from the remote peer.
The connection address returned when receiving data should be stable for the life of the Stream
.
§Connectionless mode
In connectionless mode, the stream is backed by a socket that operates in a connectionless manner, which does not
provide any assurances around reliability and ordering of messages to and from the remote peer. While a stream might
be backed by a Unix domain socket in datagram mode, which does provide reliability of messages, this cannot and
should not be relied upon when using Stream
.
Implementations§
Trait Implementations§
Source§impl From<(TcpStream, SocketAddr)> for Stream
impl From<(TcpStream, SocketAddr)> for Stream
Source§fn from((stream, remote_addr): (TcpStream, SocketAddr)) -> Self
fn from((stream, remote_addr): (TcpStream, SocketAddr)) -> Self
Source§impl From<UnixDatagram> for Stream
Available on Unix only.
impl From<UnixDatagram> for Stream
Source§fn from(socket: UnixDatagram) -> Self
fn from(socket: UnixDatagram) -> Self
Source§impl From<UnixStream> for Stream
Available on Unix only.
impl From<UnixStream> for Stream
Source§fn from(stream: UnixStream) -> Self
fn from(stream: UnixStream) -> Self
Auto Trait Implementations§
impl !Freeze for Stream
impl RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnwindSafe for Stream
Blanket Implementations§
Source§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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Track for T
impl<T> Track for T
Source§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Tracked
wrapper. Read moreSource§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Tracked
wrapper. Read more