Struct solicit::http::session::DefaultStream [] [src]

pub struct DefaultStream {
    pub stream_id: StreamId,
    pub headers: Option<Vec<Header>>,
    pub body: Vec<u8>,
    pub state: StreamState,
    // some fields omitted
}

An implementation of the Stream trait that saves all headers and data in memory.

Stores its outgoing data as a Vec<u8>.

Fields

stream_id: StreamId

The ID of the stream

headers: Option<Vec<Header>>

The headers associated with the stream (i.e. the response headers)

body: Vec<u8>

The body of the stream (i.e. the response body)

state: StreamState

The current stream state.

Methods

impl DefaultStream
[src]

fn new(stream_id: StreamId) -> DefaultStream

Create a new DefaultStream with the given ID.

fn set_full_data(&mut self, data: Vec<u8>)

Sets the outgoing data of the stream to the given Vec.

Any previously associated (and perhaps unwritten) data is discarded.

Trait Implementations

impl Clone for DefaultStream
[src]

fn clone(&self) -> DefaultStream

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Stream for DefaultStream
[src]

fn new(stream_id: StreamId) -> DefaultStream

Create a new stream with the given ID

fn new_data_chunk(&mut self, data: &[u8])

Handle a new data chunk that has arrived for the stream.

fn set_headers(&mut self, headers: Vec<Header>)

Set headers for a stream. A stream is only allowed to have one set of headers. Read more

fn set_state(&mut self, state: StreamState)

Sets the stream state to the newly provided state.

fn id(&self) -> StreamId

Returns the ID of the stream.

fn state(&self) -> StreamState

Returns the current state of the stream.

fn get_data_chunk(&mut self, buf: &mut [u8]) -> Result<StreamDataChunkStreamDataError>

Places the next data chunk that should be written onto the stream into the given buffer. Read more

fn close(&mut self)

Transitions the stream state to closed. After this, the stream is considered to be closed for any further reads or writes. Read more

fn close_local(&mut self)

Updates the Stream status to indicate that it is closed locally. Read more

fn close_remote(&mut self)

Updates the Stream status to indicate that it is closed on the remote peer's side. Read more

fn is_closed(&self) -> bool

Returns whether the stream is closed. Read more

fn is_closed_local(&self) -> bool

Returns whether the stream is closed locally.

fn is_closed_remote(&self) -> bool

Returns whether the remote peer has closed the stream. This includes a fully closed stream.