dope-uring 0.76.0

Owned io_uring backend for dope
Documentation
use std::ops::ControlFlow;

use dope_sys::table::token::{self, Codec, Tuning as _};
use o3::base::num::bounded;

use crate::{driver::Key, reactor::sq};

/// Native option completions retain their host flight until every submitted
/// scalar has completed and, when requested, the separate connect has finished.
pub trait Progress<T: Codec> {
    fn next(&mut self, queue: sq::raw::Queue<'_, T>) -> Option<Option<T::Tuning>>;
    fn has_pending(&self) -> bool;
    fn cancel_all(&mut self);
    fn cancel_at(&mut self, slot: sq::Fixed, target: Option<Key<T>>) -> ControlFlow<()>;
}

pub(crate) fn token<T: Codec>(slot: sq::Fixed) -> T::Tuning {
    let index: <T::Context as token::Context>::Slot =
        bounded::raw::U32::clamp(slot.index() as usize).into();
    T::Tuning::new(index)
}