Make sure methods in helper trait Index are inlined

This commit is contained in:
root
2015-05-23 00:39:57 +02:00
parent 37c0f53708
commit be2979d87a
+6
View File
@@ -21,14 +21,20 @@ pub trait Index : PartialEq + Copy {
}
impl Index for u8 {
#[inline(always)]
fn zero() -> Self { 0 }
#[inline(always)]
fn to_usize(self) -> usize { self as usize }
#[inline(always)]
fn from(ix: usize) -> Self { ix as u8 }
}
impl Index for u16 {
#[inline(always)]
fn zero() -> Self { 0 }
#[inline(always)]
fn to_usize(self) -> usize { self as usize }
#[inline(always)]
fn from(ix: usize) -> Self { ix as u16 }
}