[][src]Struct slabify::Index

pub struct Index { /* fields omitted */ }

An index (and generation) into an Arena.

To get an Index, insert an element into an Arena, and the Index for that element will be returned.


use generational_arena::Arena;

let mut arena = Arena::new();
let idx = arena.insert(123);
assert_eq!(arena[idx], 123);


impl Index[src]

pub fn from_raw_parts(a: usize, b: u64) -> Index[src]

Create a new Index from its raw parts.

The parts must have been returned from an earlier call to into_raw_parts.

Providing arbitrary values will lead to malformed indices and ultimately panics.

pub fn into_raw_parts(self) -> (usize, u64)[src]

Convert this Index into its raw parts.

This niche method is useful for converting an Index into another identifier type. Usually, you should prefer a newtype wrapper around Index like pub struct MyIdentifier(Index);. However, for external types whose definition you can't customize, but which you can construct instances of, this method can be useful.

Trait Implementations

impl Clone for Index[src]

impl Copy for Index[src]

impl Debug for Index[src]

impl Eq for Index[src]

impl Hash for Index[src]

impl<T> Index<Index> for Arena<T>[src]

type Output = T

The returned type after indexing.

impl<T> IndexMut<Index> for Arena<T>[src]

impl Ord for Index[src]

impl PartialEq<Index> for Index[src]

impl PartialOrd<Index> for Index[src]

impl StructuralEq for Index[src]

impl StructuralPartialEq for Index[src]

Auto Trait Implementations

impl RefUnwindSafe for Index

impl Send for Index

impl Sync for Index

impl Unpin for Index

impl UnwindSafe for Index

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.