[][src]Struct amq_protocol_tcp::TcpStreamWrapper

pub struct TcpStreamWrapper(_);

Unsafe wrapper "Cloning" the TcpStream but not closing it on drop.

Implementations

impl TcpStreamWrapper[src]

pub unsafe fn new(socket: &TcpStream) -> Self[src]

Clone the TcpStream. Original one needs to last at least for the same lifetime.

Safety

The inner TcpStream won't be closed on drop and the original one needs to live longer

Methods from Deref<Target = TcpStream>

pub fn is_connected(&self) -> bool[src]

Check whether the stream is connected or not

pub fn try_connect(&mut self) -> Result<bool, Error>[src]

Retry the connection. Returns:

  • Ok(true) if connected
  • Ok(false) if connecting
  • Err(_) if an error is encountered

pub fn is_readable(&self) -> Result<(), Error>[src]

Attempt reading from underlying stream, returning Ok(()) if the stream is readable

pub fn is_writable(&self) -> Result<(), Error>[src]

Attempt writing to underlying stream, returning Ok(()) if the stream is writable

Trait Implementations

impl AsRawFd for TcpStreamWrapper[src]

impl Deref for TcpStreamWrapper[src]

type Target = TcpStream

The resulting type after dereferencing.

impl DerefMut for TcpStreamWrapper[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.