Skip to content

Commit

Permalink
impl Debug for Candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
noib3 committed Nov 24, 2023
1 parent b7b1a26 commit 8fe3bde
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ pub(crate) enum Candidate<'a> {
Unicode(&'a [char]),
}

impl core::fmt::Debug for Candidate<'_> {
#[inline]
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Candidate::Ascii(slice) => {
core::str::from_utf8(slice).unwrap().fmt(f)
},

Candidate::Unicode(slice) => {
slice.iter().collect::<String>().fmt(f)
},
}
}
}

impl<'a> Candidate<'a> {
/// TODO: docs
#[inline(always)]
Expand Down

0 comments on commit 8fe3bde

Please sign in to comment.