Trait rustc_index::idx::Idx

source ·
pub trait Idx:
    Copy
    + 'static
    + Eq
    + PartialEq
    + Debug
    + Hash {
    // Required methods
    fn new(idx: usize) -> Self;
    fn index(self) -> usize;

    // Provided methods
    fn increment_by(&mut self, amount: usize) { ... }
    fn plus(self, amount: usize) -> Self { ... }
}
Expand description

Represents some newtyped usize wrapper.

Purpose: avoid mixing indexes for different bitvector domains.

Required Methods§

source

fn new(idx: usize) -> Self

source

fn index(self) -> usize

Provided Methods§

source

fn increment_by(&mut self, amount: usize)

source

fn plus(self, amount: usize) -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Idx for u32

source§

fn new(idx: usize) -> Self

source§

fn index(self) -> usize

source§

impl Idx for usize

source§

fn new(idx: usize) -> Self

source§

fn index(self) -> usize

Implementors§