0.6 rust重构01

This commit is contained in:
lix-2026
2026-04-14 13:22:29 +08:00
parent 71fb1aee7e
commit 84a8454fa9
401 changed files with 5841 additions and 1512 deletions
+27
View File
@@ -0,0 +1,27 @@
macro_rules! define_id {
($name:ident) => {
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct $name(pub String);
impl $name {
pub fn new(value: impl Into<String>) -> Self {
Self(value.into())
}
pub fn as_str(&self) -> &str {
&self.0
}
}
};
}
define_id!(WorkspaceId);
define_id!(PageId);
define_id!(BlockId);
define_id!(AssetId);
define_id!(AssetVersionId);
define_id!(ReferenceId);
define_id!(TaskId);
define_id!(AgentSessionId);
define_id!(CommandLogId);
define_id!(EventId);