update docs
This commit is contained in:
parent
671ff331d3
commit
b45952b6b7
5 changed files with 47 additions and 43 deletions
18
src/board.rs
18
src/board.rs
|
|
@ -123,6 +123,9 @@ impl File {
|
|||
}
|
||||
}
|
||||
|
||||
/// ## Safety
|
||||
///
|
||||
/// The caller must ensure that `index < 8`.
|
||||
#[inline]
|
||||
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
||||
debug_assert!(index < 8);
|
||||
|
|
@ -135,9 +138,9 @@ impl File {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn from_ascii(c: u8) -> Option<Self> {
|
||||
if c <= b'h' {
|
||||
match c.checked_sub(b'a') {
|
||||
pub const fn from_ascii(file: u8) -> Option<Self> {
|
||||
if file <= b'h' {
|
||||
match file.checked_sub(b'a') {
|
||||
Some(i) => Some(unsafe { Self::new_unchecked(i) }),
|
||||
None => None,
|
||||
}
|
||||
|
|
@ -213,6 +216,9 @@ impl Rank {
|
|||
}
|
||||
}
|
||||
|
||||
/// ## Safety
|
||||
///
|
||||
/// The caller must ensure that `index < 8`.
|
||||
#[inline]
|
||||
pub const unsafe fn new_unchecked(index: u8) -> Self {
|
||||
debug_assert!(index < 8);
|
||||
|
|
@ -225,9 +231,9 @@ impl Rank {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn from_ascii(c: u8) -> Option<Self> {
|
||||
if c <= b'8' {
|
||||
match c.checked_sub(b'1') {
|
||||
pub const fn from_ascii(rank: u8) -> Option<Self> {
|
||||
if rank <= b'8' {
|
||||
match rank.checked_sub(b'1') {
|
||||
Some(i) => Some(unsafe { Self::new_unchecked(i) }),
|
||||
None => None,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue