Skip to main content

hara_native/lang/protocol/
iworkrun.rs

1use super::{IClosed, IStream, IWorkRef};
2use hara_protocol_macros::hara_protocol;
3
4#[hara_protocol(
5    namespace = "std.protocol.iworkrun",
6    name = "IWorkRun",
7    parents = ["IWorkRef", "IClosed"],
8    availability = "capability-gated",
9    capability = "native-runtime-protocols"
10)]
11pub trait IWorkRun: IWorkRef + IClosed {
12    type Status;
13    type Promise;
14    type Options;
15    type Stream: IStream;
16    type Reason;
17
18    #[hara_method(value = "work-status", arity = 1)]
19    fn work_status(&self) -> Self::Status;
20    #[hara_method(value = "work-result", arity = 1)]
21    fn work_result(&self) -> Self::Promise;
22    #[hara_method(value = "work-events", arity = 2)]
23    fn work_events(&self, options: Self::Options) -> Self::Stream;
24    #[hara_method(value = "work-cancel", arity = 2)]
25    fn work_cancel(&self, reason: Self::Reason) -> Self::Promise;
26}