1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
pub use self::{apps::*, cli::*};
pub(crate) mod apps;
#[cfg(feature = "cli")]
pub(crate) mod cli;
use async_trait::async_trait;
#[async_trait]
pub trait AsyncHandler: Clone + Send + Sync {
type Error: std::error::Error + Send + Sync + 'static;
async fn handler(&self) -> Result<&Self, Self::Error>
where
Self: Sized;
}
#[async_trait]
pub trait AsyncSpawable {
async fn spawn(&mut self) -> scsys::AsyncResult<&Self>;
}
pub trait BaseApplication: BaseObject + Versionable {
fn application(&self) -> &Self {
self
}
fn namespace(&self) -> String;
}
pub trait BaseObject {
fn count(&self) -> usize;
fn name(&self) -> String;
fn slug(&self) -> String {
self.name().to_ascii_lowercase()
}
fn symbol(&self) -> String;
}
pub trait Handler: Clone {
type Error: std::error::Error + 'static;
fn handler(&self) -> Result<&Self, Self::Error>
where
Self: Sized;
}
pub trait Spawnable {
fn spawn(&mut self) -> scsys::Result<&Self>;
}
pub trait Versionable {
type Error;
fn update(&mut self) -> Result<(), Box<Self::Error>>;
fn version(&self) -> String;
}