Skip to main content

luaur_analysis/methods/
constraint_list_insert.rs

1use crate::records::constraint_list::ConstraintList;
2use crate::type_aliases::constraint_vertex::ConstraintVertex;
3
4impl ConstraintList {
5    pub fn insert(&mut self, vertex: ConstraintVertex) {
6        let (entry, fresh) = self.present.try_insert(vertex.clone(), true);
7        if fresh {
8            self.order.push(vertex);
9            self.entries += 1;
10        } else if !*entry {
11            *entry = true;
12            self.entries += 1;
13        }
14        // If the entry was *not* fresh and its value was already true, then do
15        // nothing: the set state has not changed.
16    }
17}