diff --git a/src/flow/binary/balancing.rs b/src/flow/binary/balancing.rs index 953f59a..96de525 100644 --- a/src/flow/binary/balancing.rs +++ b/src/flow/binary/balancing.rs @@ -48,7 +48,7 @@ pub enum BalancingError { impl Display for BalancingError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::Height(height_error) => write!(f, "height error: {height_error}"), + Self::Height(height_error) => write!(f, "invalid height: {height_error}"), Self::Balance(hl, hr) => write!(f, "unbalanced node: {hl} {hr}."), Self::HeightOverflow => write!(f, "tree height overflow"), Self::HeightMismatch { children, parent } => { diff --git a/src/rstd/collections/tree.rs b/src/rstd/collections/tree.rs index 9a2943e..bf74889 100644 --- a/src/rstd/collections/tree.rs +++ b/src/rstd/collections/tree.rs @@ -1,6 +1,7 @@ use std::{error::Error, fmt::Display, rc::Rc}; use crate::{ + flow::binary::*, rcore::*, rstd::{ atomic::{au64::*, *}, @@ -11,14 +12,15 @@ use crate::{ #[derive(Debug)] pub enum TreeParseError { - Height(IntParseError), + HeightParse(IntParseError), Point(PointParseError), Key(E), + HeightValue(HeightError), } impl From for TreeParseError { fn from(value: IntParseError) -> Self { - Self::Height(value) + Self::HeightParse(value) } } @@ -28,10 +30,16 @@ impl From for TreeParseError { } } +impl From for TreeParseError { + fn from(value: HeightError) -> Self { + Self::HeightValue(value) + } +} + impl Display for TreeParseError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Self::Height(height_error) => { + Self::HeightParse(height_error) => { write!(f, "failed to parse tree height: {height_error}") } Self::Point(point_error) => { @@ -40,6 +48,9 @@ impl Display for TreeParseError { Self::Key(key_error) => { write!(f, "failed to parse node key: {key_error}") } + Self::HeightValue(height_error) => { + write!(f, "invalid height: {height_error}") + } } } }