mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
* refactor project structure * environment-based default registry * fix tests * update build container * use docker platform for iso build emulation * simplify compat * Fix docker platform spec in run-compat.sh * handle riscv compat * fix bug with dep error exists attr * undo removal of sorting * use qemu for iso stage --------- Co-authored-by: Mariusz Kogen <k0gen@pm.me> Co-authored-by: Matt Hill <mattnine@protonmail.com>
54 lines
1.2 KiB
Rust
54 lines
1.2 KiB
Rust
use std::convert::Infallible;
|
|
use std::path::Path;
|
|
use std::str::FromStr;
|
|
|
|
use imbl_value::InternedString;
|
|
use serde::{Deserialize, Serialize};
|
|
use ts_rs::TS;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, TS)]
|
|
#[ts(type = "string")]
|
|
pub struct ReplayId(InternedString);
|
|
impl<T> From<T> for ReplayId
|
|
where
|
|
T: Into<InternedString>,
|
|
{
|
|
fn from(value: T) -> Self {
|
|
Self(value.into())
|
|
}
|
|
}
|
|
impl FromStr for ReplayId {
|
|
type Err = Infallible;
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
Ok(ReplayId(InternedString::intern(s)))
|
|
}
|
|
}
|
|
impl AsRef<ReplayId> for ReplayId {
|
|
fn as_ref(&self) -> &ReplayId {
|
|
self
|
|
}
|
|
}
|
|
impl std::fmt::Display for ReplayId {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{}", &self.0)
|
|
}
|
|
}
|
|
impl AsRef<str> for ReplayId {
|
|
fn as_ref(&self) -> &str {
|
|
self.0.as_ref()
|
|
}
|
|
}
|
|
impl AsRef<Path> for ReplayId {
|
|
fn as_ref(&self) -> &Path {
|
|
self.0.as_ref()
|
|
}
|
|
}
|
|
impl<'de> Deserialize<'de> for ReplayId {
|
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
where
|
|
D: serde::de::Deserializer<'de>,
|
|
{
|
|
Ok(ReplayId(serde::Deserialize::deserialize(deserializer)?))
|
|
}
|
|
}
|