memseek-test 0.26.0

Scenario-based async load testing framework with HTTP helpers, HDR histogram latency reports and graceful shutdown
Documentation
use std::{borrow::Cow, fmt};

/// 场景级全局对账失败项。
///
/// `reconcile` 阶段在所有并发任务结束后执行一次,用于检查「单轮断言看不到」的
/// 聚合不变量(如计数与明细行数一致、无重复行、缓存与库一致)。
///
/// - `name` 是稳定的类目名,便于在报告中聚合与比对基线;
/// - `detail` 是自由文本,建议包含 `expected` / `actual` 等定位信息。
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct InvariantViolation {
    /// 不变量类目(稳定标识,如 `like_count_mismatch`)。
    pub name: Cow<'static, str>,
    /// 失败详情(建议包含期望值/实际值/资源 id)。
    pub detail: String,
}

impl InvariantViolation {
    /// 构造一条不变量失败。
    pub fn new(name: impl Into<Cow<'static, str>>, detail: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            detail: detail.into(),
        }
    }
}

impl fmt::Display for InvariantViolation {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}: {}", self.name, self.detail)
    }
}