/// Adds a value with a check for uniqueness: returns a token pointing to
/// an existing element if its value matches the given one, or adds a new
/// element otherwise.
Adds a value with a check for uniqueness: returns a token pointing to
an existing element if its value matches the given one, or adds a new
element otherwise.
Adds a value with a check for uniqueness : returns a token pointing to an existing element if its value matches the given one or adds a new element otherwise .
pub fn fetch_or_append(&mut self, value: T) -> Token<T>
    where
        T: PartialEq,
    {
        if let Some(index) = self.data.iter().position(|d| d == &value) {
            Token::new(index as Index)
        } else {
            self.append(value)
        }
    }
pub fn fetch_or_append ( & mut self , value : T ) -> Token < T > where T : PartialEq , { if let Some ( index ) = self . data . iter ( ) . position ( | d | d == & value ) { Token :: new ( index as Index ) } else { self . append ( value ) } }
Adds a value with a check for uniqueness: returns a token pointing to
an existing element if its value matches the given one, or adds a new
element otherwise.
Adds a value with a check for uniqueness : returns a token pointing to an existing element if its value matches the given one or adds a new element otherwise .
&mut self
value
T