rustc-ap-rustc_data_structures 429.0.0

Automatically published version of the package `rustc_data_structures` in the rust-lang/rust repository from commit 314a79cd80ed905f80d24b79fd7acb4c8c72789b The publishing script for this crate lives at: https://github.com/alexcrichton/rustc-auto-publish
Documentation
use std::num::NonZeroU32;
use std::u32;

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct NodeIndex {
    index: NonZeroU32,
}

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
    }
}