新增: 项目状态机分层+任务状态枚举合并
真分层(df-project): - ProjectManager 加 can_transition/transition/is_terminal 状态机 - 创建加 EmptyName 校验,返回 Result 而非裸实体 - 新增 ProjectTransitionError 三种错误变体 - 调用方(idea.rs promote_idea)适配 Result 传播 双源合并: - TaskStatus::as_str 改为 const fn(允许 const 上下文调用) - task_state_machine 字符串常量从 TaskStatus enum 派生 - IdeaStatus/ProjectStatus as_str 同步改为 const fn(一致性) 架构债设计方案: - #8 IPC 错误结构化迁移路径(IpcError enum + 前端消费) - #15 AI 状态机抽离 df-ai-session(4 阶段) - #18 配置四源统一(AppConfig 单例 + 环境变量覆盖) - #19 SQLite 连接池(r2d2)
This commit is contained in:
@@ -72,7 +72,9 @@ pub enum IdeaStatus {
|
||||
|
||||
impl IdeaStatus {
|
||||
/// 返回数据库存储用的小写字符串
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
///
|
||||
/// `const fn`(与 TaskStatus::as_str 对齐,允许调用方在 const 上下文使用)。
|
||||
pub const fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
IdeaStatus::Draft => "draft",
|
||||
IdeaStatus::PendingReview => "pending_review",
|
||||
@@ -128,7 +130,9 @@ pub enum ProjectStatus {
|
||||
|
||||
impl ProjectStatus {
|
||||
/// 返回数据库存储用的小写字符串
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
///
|
||||
/// `const fn`(与 TaskStatus::as_str 对齐,允许调用方在 const 上下文使用)。
|
||||
pub const fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
ProjectStatus::Planning => "planning",
|
||||
ProjectStatus::InProgress => "in_progress",
|
||||
@@ -186,7 +190,10 @@ pub enum TaskStatus {
|
||||
|
||||
impl TaskStatus {
|
||||
/// 返回数据库存储用的小写字符串
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
///
|
||||
/// `const fn` 使调用方可在 `const` 上下文调用(任务 #17 合并:df-nodes 的
|
||||
/// `task_state_machine` 字符串常量从本方法派生,消除双源柡移)。
|
||||
pub const fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
TaskStatus::Todo => "todo",
|
||||
TaskStatus::InProgress => "in_progress",
|
||||
|
||||
Reference in New Issue
Block a user