pub unsafe trait Capacity: Copy + Debug + Eq + Hash + Ord {
    const MAX_REPRESENTABLE: usize;

    fn from_usize(i: usize) -> Self;
fn as_usize(&self) -> usize; }
Expand description

Types that can be used for indexing into array-like data structures.

Safety

Implementors must ensure that Capacity::from_usize(i).as_usize() == i for all values i <= MAX_REPRESENTABLE. Otherwise, this expression must panic or evaluate to false.

Using index_type! should be preferred over implementing this manually.

Associated Constants

The maximum usize value that can safely be represented by this type.

Required methods

Convert a usize into Self.

Convert self into usize.

Implementations on Foreign Types

Implementors