[][src]Struct typed_index_collection::Idx

pub struct Idx<T>(_, _);

Typed index.

Trait Implementations

impl<T> Clone for Idx<T>[src]

impl<T> Copy for Idx<T>[src]

impl<T: Debug> Debug for Idx<T>[src]

impl<T> Eq for Idx<T>[src]

impl<T> Hash for Idx<T>[src]

impl<T> Index<Idx<T>> for Collection<T>[src]

type Output = T

The returned type after indexing.

impl<T> IndexMut<Idx<T>> for Collection<T>[src]

pub fn index_mut(&mut self, idx: Idx<T>) -> &mut T[src]

Access a mutable reference on an entry of the Collection from its Idx.

use typed_index_collection::Collection;

let mut c = Collection::new(vec![-2, -1, 0, 1, 2]);
let negatives_idxs = c
    .iter()
    .filter(|(_, &v)| v < 0)
    .map(|(idx, _)| idx)
    .collect::<Vec<_>>();
for idx in negatives_idxs {
    *c.index_mut(idx) = 0;
}
assert_eq!(vec![0, 0, 0, 1, 2], c.take());

impl<T> Ord for Idx<T>[src]

impl<T> PartialEq<Idx<T>> for Idx<T>[src]

impl<T> PartialOrd<Idx<T>> for Idx<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Idx<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Idx<T> where
    T: Send
[src]

impl<T> Sync for Idx<T> where
    T: Sync
[src]

impl<T> Unpin for Idx<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Idx<T> where
    T: UnwindSafe
[src]

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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> 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.