1use std::sync::Arc;
4
5use grit_lib::progress::CancelToken;
6use grit_lib::remote::serve::ReceiveHook;
7
8#[derive(Clone, Default)]
10pub struct ServeSession {
11 pub receive_hook: Option<Arc<dyn ReceiveHook + Send + Sync>>,
13 pub cancel: Option<Arc<grit_lib::progress::CancelToken>>,
15}
16
17impl ServeSession {
18 #[must_use]
20 pub fn none() -> Self {
21 Self::default()
22 }
23
24 pub(crate) fn cancel(&self) -> &CancelToken {
25 if let Some(c) = self.cancel.as_deref() {
26 c
27 } else {
28 CancelToken::never_ref()
29 }
30 }
31}
32
33#[derive(Debug)]
35pub struct ReceiveRpcResult {
36 pub body: Vec<u8>,
38 pub outcome: grit_lib::remote::serve::ReceiveOutcome,
40}