Skip to main content

hara_native/lang/protocol/
icomponent.rs

1use hara_protocol_macros::hara_protocol;
2
3#[hara_protocol(namespace = "std.protocol.icomponent", name = "IComponent")]
4pub trait IComponent {
5    type Metadata;
6
7    #[hara_method(value = "props", arity = 1)]
8    fn props(&self) -> Self::Metadata;
9    #[hara_method(value = "status", arity = 1)]
10    fn status(&self) -> Self::Metadata;
11    #[hara_method(value = "started?", arity = 1)]
12    fn started(&self) -> bool;
13    #[hara_method(value = "stopped?", arity = 1)]
14    fn stopped(&self) -> bool;
15    #[hara_method(value = "start", arity = 1)]
16    fn start(&mut self);
17    #[hara_method(value = "stop", arity = 1)]
18    fn stop(&mut self);
19    #[hara_method(value = "kill", arity = 1)]
20    fn kill(&mut self) {
21        self.stop();
22    }
23    #[hara_method(value = "remote?", arity = 1)]
24    fn remote(&self) -> bool {
25        false
26    }
27}