pub unsafe trait WeakListNodeSet {
// Required methods
fn insert_ns(&mut self, ptr: usize);
fn contains_ns(&self, list: &WeakList<Self>, ptr: usize) -> bool
where Self: Sized;
fn remove_ns(&mut self, ptr: usize);
}
Expand description
WeakList
storage, needs to be able to tell whether a node belongs to this list.
Implementations can assume that:
- insert will only be called for nodes that do not already belong to the list
- remove will only be called for nodes that do already belong to the list
§Safety
This trait is unsafe because if an implementation returns true for a pointer that is not in the list, many invariants will be broken. Therefore, contains must always return the correct value.