pub struct TcpConnection { /* private fields */ }Expand description
A persistent TCP connection with length-prefixed framing.
Implementations§
Source§impl TcpConnection
impl TcpConnection
Sourcepub fn from_stream(stream: TcpStream) -> Self
pub fn from_stream(stream: TcpStream) -> Self
Wrap an already-connected TcpStream into a TcpConnection.
Trait Implementations§
Source§impl Connection for TcpConnection
impl Connection for TcpConnection
Source§fn send(&mut self, payload: &[u8]) -> Result<(), TransportError>
fn send(&mut self, payload: &[u8]) -> Result<(), TransportError>
Send a framed payload over the connection.
Source§fn recv(&mut self, timeout: Option<Duration>) -> Result<Vec<u8>, TransportError>
fn recv(&mut self, timeout: Option<Duration>) -> Result<Vec<u8>, TransportError>
Receive a framed payload. If
timeout is None, blocks indefinitely.Source§fn supports_sidecars(&self) -> bool
fn supports_sidecars(&self) -> bool
Whether this connection supports out-of-band sidecar delivery. Read more
Source§fn send_sidecar(&mut self, payload: &[u8]) -> Result<(), TransportError>
fn send_sidecar(&mut self, payload: &[u8]) -> Result<(), TransportError>
Send a sidecar payload. Default: falls back to
send().Auto Trait Implementations§
impl Freeze for TcpConnection
impl RefUnwindSafe for TcpConnection
impl Send for TcpConnection
impl Sync for TcpConnection
impl Unpin for TcpConnection
impl UnsafeUnpin for TcpConnection
impl UnwindSafe for TcpConnection
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
Mutably borrows from an owned value. Read more