Skip to content

Commit

Permalink
Impl ToArrayString for boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Mar 8, 2024
1 parent 4466450 commit e2d352e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ pub trait ToArrayString: Copy {
fn to_arraystring(self) -> Self::ArrayString;
}

impl ToArrayString for bool {
type ArrayString = ArrayString<5>;

fn to_arraystring(self) -> Self::ArrayString {
match self {
true => ArrayString::from("true").unwrap(),
false => ArrayString::from("false").unwrap(),
}
}
}

gen_fmt_to_buf!(fmt_int_to_buf(itoa::Integer));
gen_fmt_to_buf!(fmt_float_to_buf(ryu::Float));

Expand Down

0 comments on commit e2d352e

Please sign in to comment.