sark_http/owner/handoff/
mod.rs1use o3::buffer::hold;
4
5use crate::{payload::owned, request::body};
6
7pub trait Project<'d>: Sized {
9 type Proof: stage::Proof;
10 type Owner;
11
12 fn contiguous<V, T>(
13 self,
14 value: V,
15 project: impl for<'req> FnOnce(
16 V,
17 body::View<'req, 'd>,
18 Slot<'req, 'd, (), input::Bound<'req, 'd, Self::Proof>>,
19 ) -> T,
20 ) -> Result<(T, Self::Owner), (Self, V, body::Error)>;
21
22 fn segmented<V, T>(
23 self,
24 value: V,
25 project: impl for<'req> FnOnce(
26 V,
27 body::Ref<'req, 'd>,
28 Slot<'req, 'd, (), input::Bound<'req, 'd, Self::Proof>>,
29 ) -> T,
30 ) -> (T, Self::Owner);
31
32 fn discarded<V, T>(
33 self,
34 value: V,
35 project: impl for<'req> FnOnce(V, Slot<'req, 'd, (), input::Bound<'req, 'd, Self::Proof>>) -> T,
36 ) -> (T, Self::Owner);
37}
38
39pub mod copy;
40pub mod input;
41mod origin;
42mod pending;
43mod plan;
44mod ready;
45mod slot;
46pub mod stage;
47
48#[derive(Clone, Debug, PartialEq, Eq)]
49pub enum Error {
50 Retain(owned::Error),
51 Overflow(hold::Overflow),
52}
53
54#[doc(hidden)]
55pub enum Head<O> {
56 Kept,
57 Passed(O),
58}
59
60pub(crate) use origin::Origin;
61pub use pending::Pending;
62pub use plan::Plan;
63pub(crate) use plan::State;
64pub use ready::Ready;
65pub use slot::Slot;
66
67const _: () = assert!(size_of::<Error>() <= 4 * size_of::<usize>());