Struct tk_bufstream::IoBuf [] [src]

pub struct IoBuf<S: Io> {
    pub in_buf: Buf,
    pub out_buf: Buf,
    // some fields omitted
}

A wrapper for full-duplex stream

Fields

Methods

impl<S: Io> IoBuf<S>
[src]

Main trait of a stream (meaning socket) with input and output buffers

This is ought to be similar to tokio_core::Io but with buffers

Create a new IoBuf object with empty buffers

Read a chunk of data into a buffer

The data just read can then be found in self.in_buf.

This method does just one read. Because you are ought to try parse request after every read rather than reading a lot of the data in memory.

This method returns 0 when no bytes are read, both when WouldBlock occurred and when connection has been closed. You may then use self.done() to distinguish from these conditions.

Write data in the output buffer to actual stream

You should put the data to be sent into self.out_buf before flush

Returns true when connection is closed by peer

Returns a future which resolves to this stream when output buffer is flushed

Trait Implementations

impl<S: AsRawFd + Io> AsRawFd for IoBuf<S>
[src]

Extracts the raw file descriptor. Read more

impl<S: Io> Write for IoBuf<S>
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more