Struct QueuedClient

Source
pub struct QueuedClient<S: Read + Write + Source> { /* private fields */ }
Expand description

Client with a queue of requests.

The client can be used with crates like popol or with mio if feature async-mio is enabled.

When the output is ready, a next event can be sent.

Implementations§

Source§

impl<S: Read + Write + Source> QueuedClient<S>

Source

pub fn new(client: Client<S>) -> Self

New asynchronous client build on top of a synchronous client.

Source

pub fn push(&mut self, request: Request)

Push a new request in the queue.

Source

pub fn pop(&mut self) -> Option<Request>

Pop the last request in the queue.

Source

pub fn last(&self) -> Option<&Request>

Last request in the queue.

Source

pub fn has_next(&self) -> bool

Return true if there is a pending request.

Source

pub fn send_next(&mut self) -> ClientResult<bool>

Write one pending request if any.

Instance of mio::Poll generates a writable event only once until the socket returns WouldBlock. This error is mapped to ClientError::NotReady.

Source

pub fn receive_next(&mut self) -> ClientResult<Response>

Receive one response.

Must be called each time a readable event is returned by mio::Poll.

Auto Trait Implementations§

§

impl<S> Freeze for QueuedClient<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for QueuedClient<S>
where S: RefUnwindSafe,

§

impl<S> Send for QueuedClient<S>
where S: Send,

§

impl<S> Sync for QueuedClient<S>
where S: Sync,

§

impl<S> Unpin for QueuedClient<S>
where S: Unpin,

§

impl<S> UnwindSafe for QueuedClient<S>
where S: UnwindSafe,

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>,

Source§

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>,

Source§

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.