dope-core 0.75.0

Owned native I/O and completion driver for dope
Documentation
use std::{ops::ControlFlow, task};

use poll::fault;

use crate::driver::result::poll;

/// Exact failure from native dispatch or completion decoding.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Failure {
    Native(poll::Error),
    Completion(fault::Dispatch),
}

/// Drained progress or the value returned by the first stopped delivery.
pub type Dispatch<B> = Result<ControlFlow<B, poll::Drain>, Failure>;

impl From<(task::Poll<()>, fault::Fault)> for Failure {
    fn from((state, failure): (task::Poll<()>, fault::Fault)) -> Self {
        Self::Completion(fault::Dispatch::new(state.into(), failure))
    }
}