Inline NodeIndex
methods.
Because they are small and hot.
This commit is contained in:
parent
f46d0213e4
commit
a5ffcf6dd8
@ -17,11 +17,13 @@ pub struct NodeIndex {
|
||||
}
|
||||
|
||||
impl NodeIndex {
|
||||
#[inline]
|
||||
pub fn new(value: usize) -> NodeIndex {
|
||||
assert!(value < (u32::MAX as usize));
|
||||
NodeIndex { index: NonZeroU32::new((value as u32) + 1).unwrap() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get(self) -> usize {
|
||||
(self.index.get() - 1) as usize
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user