Skip to main content

conduit_cli/core/
events.rs

1#[derive(Debug, Clone)]
2pub enum LogLevel {
3    Info,
4    Warning,
5    Error,
6    Chat,
7    Command,
8}
9
10#[derive(Debug, Clone)]
11pub enum CoreEvent {
12    Info(String),
13    Success(String),
14    Warning(String),
15    Error(String),
16    Installed { slug: String, title: String },
17    AddedAsDependency { slug: String },
18    AlreadyInstalled { slug: String },
19    LinkedFile { filename: String },
20    Purged { slug: String },
21    ChatModeStarted { sender: String },
22    ChatModeStopped,
23    ChatMessageSent { sender: String, message: String },
24    ChatPromptRequested { sender: String },
25    ServerLogEvent { level: LogLevel, message: String, timestamp: String },
26    ServerStopEvent(String),
27    WorldPreparationStarted,
28    WorldPreparationProgress { percentage: u8 },
29    WorldPreparationFinished,
30    StartingServer,
31    TaskStarted(String),
32    TaskFinished,
33}
34
35#[derive(Debug, Clone)]
36pub struct DownloadProgress {
37    pub bytes_downloaded: u64,
38    pub total_bytes: Option<u64>,
39    pub filename: String,
40}
41
42pub trait CoreCallbacks {
43    fn on_event(&mut self, _event: CoreEvent) {}
44    fn on_download_progress(&mut self, _progress: DownloadProgress) {}
45}