diff --git a/src/board.rs b/src/board.rs index 8e12050..85b4ff4 100644 --- a/src/board.rs +++ b/src/board.rs @@ -128,7 +128,7 @@ impl File { #[inline] pub fn from_char(file: char) -> Option { - Self::from_ascii(file as u8) + Some(Self::from_ascii(u8::try_from(file).ok()?)?) } #[inline] @@ -208,7 +208,7 @@ impl Rank { #[inline] pub fn from_char(rank: char) -> Option { - Self::from_ascii(rank as u8) + Some(Self::from_ascii(u8::try_from(rank).ok()?)?) } #[inline]