use std::fmt;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub struct ExecutionLaneId(String);
impl ExecutionLaneId {
pub fn new(value: impl Into<String>) -> Self {
Self(value.into())
}
pub fn main() -> Self {
Self::new("main")
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for ExecutionLaneId {
fn default() -> Self {
Self::main()
}
}
impl fmt::Display for ExecutionLaneId {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct ExecutionLanePlan {
id: ExecutionLaneId,
}
impl ExecutionLanePlan {
pub fn new(id: impl Into<String>) -> Self {
Self {
id: ExecutionLaneId::new(id),
}
}
pub const fn id(&self) -> &ExecutionLaneId {
&self.id
}
}
#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
pub struct ExecutionClassId(String);
impl ExecutionClassId {
pub fn new(value: impl Into<String>) -> Self {
Self(value.into())
}
pub fn native_rust() -> Self {
Self::new("lenso.native-rust@1")
}
pub fn bun_child_process() -> Self {
Self::new("lenso.bun-process@1")
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl fmt::Display for ExecutionClassId {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}