Skip to main content

sema_core/runtime/
cancel.rs

1use super::{RootId, ScopeId, TaskId};
2
3#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4pub enum CancellationParent {
5    None,
6    Root(RootId),
7    Scope(ScopeId),
8    Task(TaskId),
9}
10
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub enum LifetimeOwner {
13    Interpreter,
14    Root(RootId),
15    Scope(ScopeId),
16    Task(TaskId),
17}
18
19#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20pub enum CancelReason {
21    Root,
22    Owner,
23    Explicit,
24    Timeout,
25    HostStop,
26    ResourceDisconnect,
27    InterpreterShutdown,
28}
29
30#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct TaskRelations {
32    pub origin_root: RootId,
33    pub cancellation_parent: CancellationParent,
34    pub lifetime_owner: LifetimeOwner,
35}