TreeParseError::HeightValue
This commit is contained in:
parent
9d5b4c5fd4
commit
b437ff3514
@ -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 } => {
|
||||
|
@ -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<E> {
|
||||
Height(IntParseError),
|
||||
HeightParse(IntParseError),
|
||||
Point(PointParseError),
|
||||
Key(E),
|
||||
HeightValue(HeightError),
|
||||
}
|
||||
|
||||
impl<E> From<IntParseError> for TreeParseError<E> {
|
||||
fn from(value: IntParseError) -> Self {
|
||||
Self::Height(value)
|
||||
Self::HeightParse(value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,10 +30,16 @@ impl<E> From<PointParseError> for TreeParseError<E> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E> From<HeightError> for TreeParseError<E> {
|
||||
fn from(value: HeightError) -> Self {
|
||||
Self::HeightValue(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Display> Display for TreeParseError<E> {
|
||||
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<E: Display> Display for TreeParseError<E> {
|
||||
Self::Key(key_error) => {
|
||||
write!(f, "failed to parse node key: {key_error}")
|
||||
}
|
||||
Self::HeightValue(height_error) => {
|
||||
write!(f, "invalid height: {height_error}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user