Struct mio_httpc::SimpleCall

source ·
pub struct SimpleCall { /* private fields */ }
Expand description

Simplified API for non-streaming requests and responses. If body exists it needs to be provided to Request. If response has a body it is returned in Response.

Implementations§

source§

impl SimpleCall

source

pub fn is_ref(&self, r: CallRef) -> bool

source

pub fn call(&self) -> &Call

source

pub fn finish_inplace(&mut self) -> Option<(Response, Vec<u8>)>

Replaces self with an empty SimpleCall and returns result if any.

source

pub fn finish(self) -> Option<(Response, Vec<u8>)>

Consume and return response with body.

source

pub fn abort_inplace(&mut self, htp: &mut Httpc)

Abort and replace self with an empty call.

source

pub fn abort(self, htp: &mut Httpc)

Consume and abort call.

source

pub fn is_call(&self, cid: &Option<CallRef>) -> bool

For quick comparison with httpc::event response. If cid is none will return false.

source

pub fn is_opt_callid(a: &Option<SimpleCall>, b: &Option<CallRef>) -> bool

If using Option in a struct, you can quickly compare callid from httpc::event. If either is none will return false.

source

pub fn is_done(&self) -> bool

Is request finished.

source

pub fn is_receiving(&self) -> bool

Are we in receiving state

source

pub fn perform(&mut self, htp: &mut Httpc, poll: &Registry) -> Result<bool>

Perform operation. Returns true if request is finished.

source

pub fn empty() -> SimpleCall

An empty SimpleCall not associated with a valid mio::Token/CallId. Exists to be overwritten with an actual valid request. Always returns is_done true.

source

pub fn is_empty(&self) -> bool

Trait Implementations§

source§

impl From<Call> for SimpleCall

source§

fn from(v: Call) -> SimpleCall

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V