[][src]Struct typed_generational_arena::Index

pub struct Index<T, I = usize, G = u64> { /* 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.

Examples

use typed_generational_arena::StandardArena;

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

Methods

impl<T, I: ArenaIndex + Copy, G: FixedGenerationalIndex + Copy> Index<T, I, G>[src]

pub fn to_idx(&self) -> usize[src]

Get this index as a usize

pub fn arr_idx(&self) -> I[src]

Get this index's array index into the arena

pub fn gen(&self) -> G[src]

Get this index's generation

impl<T, I: ArenaIndex + Copy, G: FixedGenerationalIndex> Index<T, I, G>[src]

pub fn from_idx_first_gen(n: usize) -> Self[src]

Convert a usize to an index at the first generation

impl<T, I: ArenaIndex + Copy, G: IgnoredGeneration> Index<T, I, G>[src]

pub fn from_idx(n: usize) -> Self[src]

Convert a usize to an index (with generations ignored)

impl<T, I: ArenaIndex, G: FixedGenerationalIndex> Index<T, I, G>[src]

pub fn new(index: I, generation: G) -> Index<T, I, G>[src]

Create a new index from a given array index and generation

Trait Implementations

impl<T, I, G> Debug for Index<T, I, G> where
    I: Debug,
    G: Debug
[src]

impl<T, I, G> PartialEq<Index<T, I, G>> for Index<T, I, G> where
    I: PartialEq,
    G: PartialEq
[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl<T, I, G> Eq for Index<T, I, G> where
    I: Eq,
    G: Eq
[src]

impl<T, I: ArenaIndex + Ord, G: FixedGenerationalIndex> Ord for Index<T, I, G>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T, I: ArenaIndex + PartialOrd, G: FixedGenerationalIndex> PartialOrd<Index<T, I, G>> for Index<T, I, G>[src]

#[must_use] fn lt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use] fn le(&self, other: &Rhs) -> bool1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use] fn gt(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use] fn ge(&self, other: &Rhs) -> bool1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T, I: ArenaIndex, G: FixedGenerationalIndex> Index<Index<T, I, G>> for Arena<T, I, G>[src]

type Output = T

The returned type after indexing.

impl<T, I: ArenaIndex, G: FixedGenerationalIndex> IndexMut<Index<T, I, G>> for Arena<T, I, G>[src]

impl<T, I, G> Hash for Index<T, I, G> where
    I: Hash,
    G: Hash
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T, I: ArenaIndex + Copy, G: FixedGenerationalIndex + Copy> Copy for Index<T, I, G>[src]

impl<T, I, G> Clone for Index<T, I, G> where
    I: Clone,
    G: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<T, I, G> Unpin for Index<T, I, G> where
    G: Unpin,
    I: Unpin

impl<T, I, G> Sync for Index<T, I, G> where
    G: Sync,
    I: Sync

impl<T, I, G> Send for Index<T, I, G> where
    G: Send,
    I: Send

impl<T, I, G> UnwindSafe for Index<T, I, G> where
    G: UnwindSafe,
    I: UnwindSafe

impl<T, I, G> RefUnwindSafe for Index<T, I, G> where
    G: RefUnwindSafe,
    I: RefUnwindSafe

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.