[][src]Struct pea2pea::ConnectionReader

pub struct ConnectionReader {
    pub node: Arc<Node>,
    pub addr: SocketAddr,
    pub buffer: Box<[u8]>,
    pub carry: usize,
    pub reader: OwnedReadHalf,
}

An object dedicated to performing reads from a connection's stream.

Fields

node: Arc<Node>

A reference to the owning node.

addr: SocketAddr

The address of the connection.

buffer: Box<[u8]>

A buffer dedicated to reading from the stream.

carry: usize

The number of bytes from an incomplete read carried over in the buffer.

reader: OwnedReadHalf

The read half of the stream.

Implementations

impl ConnectionReader[src]

pub async fn read_queued_bytes(&mut self) -> Result<&[u8]>[src]

Reads as many bytes as there are queued to be read from the stream.

pub async fn read_exact(&mut self, num: usize) -> Result<&[u8]>[src]

Reads the specified number of bytes from the stream.

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.