Inline NodeIndex
methods.
Because they are small and hot.
This commit is contained in:
parent
f46d0213e4
commit
a5ffcf6dd8
1 changed files with 2 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue