Skip to main content

dope_sys/engine/admit/
reserve.rs

1use crate::{
2    engine::admit::{Context, Error, Native, Submission},
3    io::request,
4};
5
6type Failure<C> = Error<<<C as Context>::Native as Native>::Error<<C as Context>::Failure>>;
7
8/// Binds the exact host key and pending state before reserving native capacity.
9///
10/// Descriptor-local admission also retains the slot's matching operation when
11/// its native requests use a descriptor-local token.
12pub trait Reserve<'a, C: Context, B: 'a>: Submission {
13    fn try_new(backend: &'a mut B, key: C::Key, pending: bool) -> Result<Self, Failure<C>>;
14
15    /// Binds a descriptor-local cancellation to its exact flight identity.
16    /// The caller retains its descriptor and target on every admission outcome.
17    fn try_at(
18        backend: &'a mut B,
19        key: C::Key,
20        pending: bool,
21        _slot: &<C::Inputs as request::Context>::Target,
22    ) -> Result<Self, Failure<C>> {
23        Self::try_new(backend, key, pending)
24    }
25}