Lines Matching full:safety
176 // SAFETY: An [`RBTree`] allows the same kinds of access to its values that a struct allows to its
180 // SAFETY: An [`RBTree`] allows the same kinds of access to its values that a struct allows to its
202 // SAFETY: by the invariants, all pointers are valid. in iter()
217 // SAFETY: by the invariants, all pointers are valid. in iter_mut()
242 // SAFETY: `self.root` is always a valid root node in cursor_front()
257 // SAFETY: `self.root` is always a valid root node in cursor_back()
327 // SAFETY: `raw_self` is a valid pointer to the `RBTree` (created from `self` above). in raw_entry()
331 // SAFETY: All links fields we create are in a `Node<K, V>`. in raw_entry()
334 // SAFETY: `node` is a non-null node so it is valid by the type invariants. in raw_entry()
336 // SAFETY: `curr` is a non-null node so it is valid by the type invariants. in raw_entry()
338 // SAFETY: `curr` is a non-null node so it is valid by the type invariants. in raw_entry()
378 … // SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self` in get()
381 // SAFETY: `this` is a non-null node so it is valid by the type invariants. in get()
383 // SAFETY: `node` is a non-null node so it is valid by the type invariants. in get()
385 // SAFETY: `node` is a non-null node so it is valid by the type invariants. in get()
387 // SAFETY: `node` is a non-null node so it is valid by the type invariants. in get()
425 … // SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self` in cursor_lower_bound()
428 // SAFETY: `this` is a non-null node so it is valid by the type invariants. in cursor_lower_bound()
430 // SAFETY: `node` is a non-null node so it is valid by the type invariants. in cursor_lower_bound()
432 // SAFETY: `node` is a non-null node so it is valid by the type invariants. in cursor_lower_bound()
446 … // SAFETY: `best` is a non-null node so it is valid by the type invariants. in cursor_lower_bound()
461 // SAFETY: `best` is a non-null node so it is valid by the type invariants. in cursor_lower_bound()
483 // SAFETY: `root` is valid as it's embedded in `self` and we have a valid `self`. in drop()
488 // SAFETY: All links fields we create are in a `Node<K, V>`. in drop()
492 // SAFETY: `next` and all nodes in postorder are still valid. in drop()
498 // SAFETY: `this` is valid per the loop invariant. in drop()
728 // SAFETY: The [`Cursor`] has exclusive access to both `K` and `V`, so it is sufficient to require …
733 // SAFETY: The [`Cursor`] gives out immutable references to K and mutable references to V,
734 // so it has the same thread safety requirements as mutable references.
740 // SAFETY: in current()
748 // SAFETY: in current_mut()
762 // SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self` in remove_current()
765 // SAFETY: `this` is valid by the type invariants as described above. in remove_current()
768 // SAFETY: The reference to the tree used to create the cursor outlives the cursor, so in remove_current()
804 // SAFETY: The reference to the tree used to create the cursor outlives the cursor, so in remove_neighbor()
807 … // SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self` in remove_neighbor()
810 // SAFETY: `this` is valid by the type invariants as described above. in remove_neighbor()
848 // SAFETY: in peek()
867 // SAFETY: in peek_mut()
875 // SAFETY: `self.current` is valid by the type invariants. in get_neighbor_raw()
886 /// # Safety
891 // SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`. in to_key_value()
893 // SAFETY: the caller guarantees immutable access to `node`. in to_key_value()
897 /// # Safety
902 // SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`. in to_key_value_mut()
904 // SAFETY: the caller guarantees mutable access to `node`. in to_key_value_mut()
908 /// # Safety
913 // SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self` in to_key_value_raw()
916 // SAFETY: The passed `node` is the current node or a non-null neighbor, in to_key_value_raw()
919 // SAFETY: The passed `node` is the current node or a non-null neighbor, in to_key_value_raw()
951 // SAFETY: The [`Iter`] gives out immutable references to K and V, so it has the same
952 // thread safety requirements as immutable references.
955 // SAFETY: The [`Iter`] gives out immutable references to K and V, so it has the same
956 // thread safety requirements as immutable references.
963 // SAFETY: Due to `self._tree`, `k` and `v` are valid for the lifetime of `'a`. in next()
985 // SAFETY: The [`IterMut`] has exclusive access to both `K` and `V`, so it is sufficient to require…
990 // SAFETY: The [`IterMut`] gives out immutable references to K and mutable references to V, so it h…
991 // thread safety requirements as mutable references.
999 … // SAFETY: Due to `&mut self`, we have exclusive access to `k` and `v`, for the lifetime of `'a`. in next()
1022 // SAFETY: By the type invariant of `IterRaw`, `self.next` is a valid node in an `RBTree`, in next()
1026 // SAFETY: `self.next` is a valid tree node by the type invariants. in next()
1029 // SAFETY: By the same reasoning above, it is safe to dereference the node. in next()
1053 // SAFETY: This doesn't actually contain K or V, and is just a memory allocation. Those can always
1057 // SAFETY: This doesn't actually contain K or V, and is just a memory allocation.
1100 // SAFETY: If K and V can be sent across threads, then it's also okay to send [`RBTreeNode`] across
1104 // SAFETY: If K and V can be accessed without synchronization, then it's also okay to access
1171 // SAFETY: `node` is valid at least until we call `Box::from_raw`, which only happens when in insert()
1177 …// SAFETY: The type invariants of `RawVacantEntry` are exactly the safety requirements of `rb_link… in insert()
1180 // SAFETY: All pointers are valid. `node` has just been inserted into the tree. in insert()
1183 // SAFETY: The node is valid until we remove it from the tree. in insert()
1208 // SAFETY: in get()
1216 // SAFETY: in get_mut()
1226 // SAFETY: in into_mut()
1234 // SAFETY: The node is a node in the tree, so it is valid. in remove_node()
1240 // SAFETY: The node was a node in the tree, but we removed it, so we can convert it in remove_node()
1262 // SAFETY: `node` is valid at least until we call `Box::from_raw`, which only happens when in replace()
1266 // SAFETY: This updates the pointers so that `new_node_links` is in the tree where in replace()
1272 // SAFETY: in replace()