Scaffold Lumbridge architecture and research plan
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
//! Stable domain contracts shared by Lumbridge frontends and runtimes.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Platform {
|
||||
MacOs,
|
||||
UbuntuLinux,
|
||||
ArchLinux,
|
||||
OtherLinux,
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
impl Platform {
|
||||
#[must_use]
|
||||
pub const fn current() -> Self {
|
||||
if cfg!(target_os = "macos") {
|
||||
Self::MacOs
|
||||
} else if cfg!(target_os = "linux") {
|
||||
Self::OtherLinux
|
||||
} else {
|
||||
Self::Unsupported
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Platform {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let name = match self {
|
||||
Self::MacOs => "macOS",
|
||||
Self::UbuntuLinux => "Ubuntu Linux",
|
||||
Self::ArchLinux => "Arch Linux / Omarchy",
|
||||
Self::OtherLinux => "Linux",
|
||||
Self::Unsupported => "unsupported platform",
|
||||
};
|
||||
formatter.write_str(name)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum UsageProvenance {
|
||||
ProviderReported,
|
||||
HarnessReported,
|
||||
LocallyMeasured,
|
||||
Estimated,
|
||||
Unavailable,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct ProductStatus {
|
||||
pub platform: Platform,
|
||||
pub message: &'static str,
|
||||
}
|
||||
|
||||
impl ProductStatus {
|
||||
#[must_use]
|
||||
pub const fn architecture_phase(platform: Platform) -> Self {
|
||||
Self {
|
||||
platform,
|
||||
message: "Architecture scaffold only; no terminal sessions are started yet.",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Platform, ProductStatus, UsageProvenance};
|
||||
|
||||
#[test]
|
||||
fn scaffold_status_is_explicit() {
|
||||
let status = ProductStatus::architecture_phase(Platform::UbuntuLinux);
|
||||
assert!(status.message.contains("scaffold"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn usage_can_be_explicitly_unavailable() {
|
||||
assert_eq!(UsageProvenance::Unavailable, UsageProvenance::Unavailable);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user