修复 Arc::make_mut 遗留问题

增加 基础数据对比方法
This commit is contained in:
YuWuKunCheng
2026-06-05 16:35:31 +08:00
parent 823a24d364
commit e33b1f0744
17 changed files with 1809 additions and 24 deletions
+63 -1
View File
@@ -66,7 +66,7 @@ impl 分型 {
: Option<Arc<K线>>, : Arc<K线>, : Option<Arc<K线>>
) -> Self {
if let (Some(), Some()) = (&, &) {
debug_assert!(
assert!(
..load(Ordering::Relaxed) < ..load(Ordering::Relaxed)
&& ..load(Ordering::Relaxed) < ..load(Ordering::Relaxed),
"分型时间戳断言失败: 左={}, 中={}, 右={}",
@@ -256,6 +256,68 @@ impl 分型 {
}
.push();
}
/// 结构化相等校验 — 递归校验左/中/右缠伦K线 + 自有缓存字段,返回 (是否相等, 差异描述)
pub fn (&self, other: &Self, : f64) -> (bool, String) {
match (&self., &other.) {
(None, None) => {}
(Some(a), Some(b)) => {
let (eq, msg) = a.(b, );
if !eq {
return (false, format!("分型: [左]缠论K线异常 >> {msg}"));
}
}
(a, b) => {
return (
false,
format!("分型: [左]空值不一致 A={},B={}", a.is_some(), b.is_some()),
);
}
}
{
let (eq, msg) = self..(&other., );
if !eq {
return (false, format!("分型: [中]缠论K线异常 >> {msg}"));
}
}
match (&self., &other.) {
(None, None) => {}
(Some(a), Some(b)) => {
let (eq, msg) = a.(b, );
if !eq {
return (false, format!("分型: [右]缠论K线异常 >> {msg}"));
}
}
(a, b) => {
return (
false,
format!("分型: [右]空值不一致 A={},B={}", a.is_some(), b.is_some()),
);
}
}
if self. != other. {
return (
false,
format!("分型: [结构] 不等 A={},B={}", self., other.),
);
}
if self. != other. {
return (
false,
format!("分型: [时间戳] 不等 A={},B={}", self., other.),
);
}
if (self. - other.).abs() > {
return (
false,
format!(
"分型: [分型特征值] 浮点超限 A={:.10},B={:.10}",
self., other.
),
);
}
(true, "分型: 全部字段一致".into())
}
}
impl crate::types::fractal:: for {