clarify TreeParseError

This commit is contained in:
AF 2023-06-18 12:34:16 +00:00
parent 3b7eff34d2
commit ce32360e35

View File

@ -4,14 +4,14 @@ use crate::rstd::{atomic::au64::*, point::*};
#[derive(Debug)] #[derive(Debug)]
pub enum TreeParseError<E> { pub enum TreeParseError<E> {
Int(IntParseError), Height(IntParseError),
Point(PointParseError), Point(PointParseError),
Key(E), Key(E),
} }
impl<E> From<IntParseError> for TreeParseError<E> { impl<E> From<IntParseError> for TreeParseError<E> {
fn from(value: IntParseError) -> Self { fn from(value: IntParseError) -> Self {
Self::Int(value) Self::Height(value)
} }
} }
@ -24,8 +24,8 @@ impl<E> From<PointParseError> for TreeParseError<E> {
impl<E: Display> Display for TreeParseError<E> { impl<E: Display> Display for TreeParseError<E> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::Int(int_error) => { Self::Height(height_error) => {
write!(f, "failed to parse tree height: {int_error}") write!(f, "failed to parse tree height: {height_error}")
} }
Self::Point(point_error) => { Self::Point(point_error) => {
write!(f, "failed to parse node reference: {point_error}") write!(f, "failed to parse node reference: {point_error}")