rustc_index::idx

Trait 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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§