Files
SCOPENET-MC/crates/core/src/progress.rs
T
Claude 8cdf616a94 Add launcher engine (scopenet-core) and admin panel server
- scopenet-shared: wire types for branding, auth, instances, manifests
- scopenet-core: Mojang versions/libraries/assets, automatic Java runtimes,
  Fabric/Quilt/Forge/NeoForge installation, file sync, launch command
  builder, Microsoft auth, servers.dat injection, server list ping
- scopenet-panel: Axum + SQLite admin API with JWT auth, users/groups,
  branding, settings, instances, Modrinth/CurseForge/zip import, file
  hosting and launch stats

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ARcGWxLx21FwXJ3yfGriS
2026-09-28 04:22:17 +00:00

34 lines
845 B
Rust

use serde::Serialize;
use std::sync::Arc;
#[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum Stage {
Preparing,
Java,
Game,
Loader,
Files,
Launching,
}
#[derive(Debug, Clone, Serialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Event {
Stage { stage: Stage, label: String },
Progress { stage: Stage, done: u64, total: u64, files_done: u32, files_total: u32 },
Log { line: String },
}
/// Callback the engine uses to report progress. Must be cheap: it is called
/// from download tasks (throttled to ~10 Hz).
pub type Reporter = Arc<dyn Fn(Event) + Send + Sync>;
pub fn noop() -> Reporter {
Arc::new(|_| {})
}
pub fn stage(r: &Reporter, stage: Stage, label: impl Into<String>) {
r(Event::Stage { stage, label: label.into() });
}