unistore-progress 0.1.0

Progress tracking capability for UniStore
Documentation
//! 【错误类型】- 进度追踪错误定义
//!
//! 职责:
//! - 定义进度追踪相关的错误类型
//! - 提供错误转换

use thiserror::Error;

/// 进度追踪错误
#[derive(Debug, Error)]
pub enum ProgressError {
    /// 进度已完成,无法继续操作
    #[error("进度已完成")]
    AlreadyFinished,

    /// 进度值超出范围
    #[error("进度值超出范围: {current} > {total}")]
    OutOfRange {
        /// 当前值
        current: u64,
        /// 总数
        total: u64,
    },

    /// 订阅通道已关闭
    #[error("订阅通道已关闭")]
    ChannelClosed,

    /// 无效的总数(必须 > 0)
    #[error("无效的总数: {0}(必须大于 0)")]
    InvalidTotal(u64),
}

/// 进度追踪结果类型别名
pub type ProgressResult<T> = Result<T, ProgressError>;