token_deque/
token.rs

1/// A token representing an item in the `List`. It can be used to try
2/// and remove the item from the list, or try to get the value of the
3/// item in the list. It contains a generation number that prevents
4/// the wrong item (that may have come to inhabit the same location)
5/// from being removed.
6///
7/// Tokens can be stored in other data structures, and do not have
8/// lifetime bindings to the list that created them. Furthermore, they
9/// can safely be serialized as they do not contain pointers.
10///
11/// While the type system allows it, using a `Token` with a list other
12/// than the one that created it will result in (likely) unexpected
13/// behavior.
14#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct Token {
16    pub(crate) ix: usize,
17    pub(crate) generation: usize,
18}