Skip to content

Commit

Permalink
Merge pull request #43 from metaborg/impl-debug
Browse files Browse the repository at this point in the history
impl debug
  • Loading branch information
AZWN authored May 7, 2024
2 parents ec1129a + ba0a062 commit 231fcd4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scopegraphs/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ impl<'sg, LABEL, DATA> Env<'sg, LABEL, DATA> {
}

/// Error emitted by [Env::get_only_item] when the environment argument did not contain exactly one argument.
#[derive(Debug)]
pub enum OnlyElementError<'a, 'sg, DATA, LABEL, I>
where
I: Iterator<Item = &'a ResolvedPath<'sg, DATA, LABEL>>,
Expand All @@ -249,6 +248,20 @@ where
},
}

impl<'a, 'sg, DATA, LABEL, I> Debug for OnlyElementError<'a, 'sg, DATA, LABEL, I>
where
I: Iterator<Item = &'a ResolvedPath<'sg, DATA, LABEL>>,
{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
OnlyElementError::Empty => write!(f, "OnlyElementError::Empty"),
OnlyElementError::Multiple { .. } => {
write!(f, "OnlyElementError::Multiple {{..}}")
}
}
}
}

impl<'a, 'sg, DATA, LABEL, I> IntoIterator for OnlyElementError<'a, 'sg, DATA, LABEL, I>
where
I: Iterator<Item = &'a ResolvedPath<'sg, DATA, LABEL>>,
Expand All @@ -262,7 +275,6 @@ where
}

/// Iterator over an [`OnlyElementError`], to easily access its elements.
#[derive(Debug)]
pub struct OnlyElementErrorIter<'a, 'sg, DATA, LABEL, I>
where
I: Iterator<Item = &'a ResolvedPath<'sg, DATA, LABEL>>,
Expand Down

0 comments on commit 231fcd4

Please sign in to comment.