A Vector type where the key is a custom object to avoid mixing indices between vectors.
```rust use keyed_vec::{KeyedVec, IndexLike};
struct Client { name: String, }
struct Order { address: String }
struct ClientId(usize); impl IndexLike for ClientId { fn to_index(&self) -> usize { self.0 }
fn from_index(i: usize) -> Self {
ClientId(i)
}
}
struct OrderId(usize); impl IndexLike for OrderId { fn to_index(&self) -> usize { self.0 }
fn from_index(i: usize) -> Self {
OrderId(i)
}
}
let mut clients = KeyedVec::
let mut orders = KeyedVec::
// mismatched types expected ClientId
, found OrderId
clients.get(order_1);
```