Add '# Safety' section to 'unsafe fn' doc
This commit is contained in:
parent
b6f1e76300
commit
fa1bf74c44
6 changed files with 24 additions and 0 deletions
|
|
@ -20,6 +20,10 @@ impl Color {
|
|||
}
|
||||
|
||||
/// Convert from a piece index into a [Color] type, no bounds checking.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Should only be called with values that can be output by [Color::index()].
|
||||
#[inline(always)]
|
||||
pub unsafe fn from_index_unchecked(index: usize) -> Self {
|
||||
std::mem::transmute(index as u8)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue