Minor code cleanup in ascii char
This commit is contained in:
parent
f6f531cf56
commit
0b5ca8ee66
@ -1,19 +1,9 @@
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum AsciiChar {
|
||||
NOT_ASCII,
|
||||
ASCII(u8),
|
||||
}
|
||||
|
||||
impl Clone for AsciiChar {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
AsciiChar::NOT_ASCII => return AsciiChar::NOT_ASCII,
|
||||
AsciiChar::ASCII(c) => return AsciiChar::ASCII(*c),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Copy for AsciiChar {}
|
||||
|
||||
impl PartialEq<Self> for AsciiChar {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match self {
|
||||
@ -52,6 +42,11 @@ impl PartialEq<char> for AsciiChar {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn _ascii_char_size() {
|
||||
println!("{}", std::mem::size_of::<AsciiChar>());
|
||||
}
|
||||
|
||||
impl PartialEq<AsciiChar> for char {
|
||||
fn eq(&self, other: &AsciiChar) -> bool {
|
||||
match other {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user