Enum DispatchState
pub enum DispatchState {
NotStarted {
cmd_tx: Sender<Command>,
command: Command,
},
Reserving(Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>),
Sent,
}Expand description
State of a future before its command has been pushed onto the event-loop channel.
Owns a cloned Command sender rather than borrowing the client, so the
operation futures are 'static and can be tokio::spawned or stored.
Variants§
NotStarted
First poll has not yet happened; the command is built but not yet sent.
Command is an enum, so it is stored inline. No boxing needed.
Reserving(Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>)
Waiting for a permit on the bounded command channel.
Sent
Command has been pushed; nothing left to dispatch.
Implementations§
§impl DispatchState
impl DispatchState
pub const fn new(cmd_tx: Sender<Command>, command: Command) -> Self
pub fn poll_dispatch(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
pub fn poll_dispatch(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
Drives dispatch until the command has been pushed onto the channel.
Returns Ready(Ok(())) once the command has been sent (or was
already sent), Ready(Err(_)) on permanent failure, or Pending
while waiting for channel capacity.
Auto Trait Implementations§
impl Freeze for DispatchState
impl !RefUnwindSafe for DispatchState
impl Send for DispatchState
impl !Sync for DispatchState
impl Unpin for DispatchState
impl !UnwindSafe for DispatchState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more