Skip to main content

dope_sys/probe/session/
occupied.rs

1use crate::probe::{
2    self, Stopped,
3    session::{Checked, Empty, Session, Stage},
4};
5
6type Failure<S, E> = Checked<
7    <S as Session>::Probe,
8    <<S as Session>::Outcome as probe::Outcome>::Observation,
9    <S as Session>::Error,
10    <S as Occupied>::Index,
11    <S as Occupied>::Length,
12    <S as Occupied>::Capacity,
13    E,
14>;
15
16type Progress<S, E> = Result<<S as Session>::Pending, Stopped<Stage<S>, Failure<S, E>>>;
17
18pub trait Occupied: Session {
19    type Empty: Empty<Occupied = Self>;
20    type Target;
21    type Remove;
22    type Index;
23    type Length;
24    type Capacity;
25
26    fn slot(&self) -> Self::Target;
27    fn try_remove(self) -> Result<Self::Empty, Stopped<Self, Self::Remove>>;
28    fn next<E>(
29        waiting: Self::Pending,
30        check: impl FnOnce(&[u8]) -> Result<(), E>,
31    ) -> Progress<Self, E>;
32}