Lines Matching full:current
249 let current = unsafe { bindings::rb_first(root) }; in cursor_front_mut() localVariable
250 NonNull::new(current).map(|current| { in cursor_front_mut()
252 // - `current` is a valid node in the [`RBTree`] pointed to by `self`. in cursor_front_mut()
254 current, in cursor_front_mut()
264 let current = unsafe { bindings::rb_first(root) }; in cursor_front() localVariable
265 NonNull::new(current).map(|current| { in cursor_front()
267 // - `current` is a valid node in the [`RBTree`] pointed to by `self`. in cursor_front()
269 current, in cursor_front()
279 let current = unsafe { bindings::rb_last(root) }; in cursor_back_mut() localVariable
280 NonNull::new(current).map(|current| { in cursor_back_mut()
282 // - `current` is a valid node in the [`RBTree`] pointed to by `self`. in cursor_back_mut()
284 current, in cursor_back_mut()
294 let current = unsafe { bindings::rb_last(root) }; in cursor_back() localVariable
295 NonNull::new(current).map(|current| { in cursor_back()
297 // - `current` is a valid node in the [`RBTree`] pointed to by `self`. in cursor_back()
299 current, in cursor_back()
460 NonNull::new(best.as_ptr()).map(|current| { in cursor_lower_bound_mut()
462 // - `current` is a valid node in the [`RBTree`] pointed to by `self`. in cursor_lower_bound_mut()
464 current, in cursor_lower_bound_mut()
481 NonNull::new(best.as_ptr()).map(|current| { in cursor_lower_bound()
483 // - `current` is a valid node in the [`RBTree`] pointed to by `self`. in cursor_lower_bound()
485 current, in cursor_lower_bound()
548 // Find out what the next node is before disposing of the current one. in drop()
581 /// let mut current = cursor.current();
582 /// assert_eq!(current, (&10, &100));
586 /// current = cursor.current();
587 /// assert_eq!(current, (&20, &200));
592 /// current = cursor.current();
593 /// assert_eq!(current, (&20, &200));
597 /// current = cursor.current();
598 /// assert_eq!(current, (&30, &300));
619 /// let current = cursor.current();
620 /// assert_eq!(current, (&30, &300));
653 /// let current = cursor.current();
654 /// assert_eq!(current, (&20, &200));
658 /// let current = cursor.current();
659 /// assert_eq!(current, (&30, &300));
684 /// // Get a mutable reference to the current value.
695 … allows node removal. The following examples demonstrate the behavior of removing the current node.
710 /// let mut current = cursor.current();
711 /// assert_eq!(current, (&10, &100));
714 /// // If a node exists after the current element, it is returned.
715 /// current = cursor.current();
716 /// assert_eq!(current, (&20, &200));
720 /// current = cursor.current();
721 /// assert_eq!(current, (&30, &300));
725 /// current = cursor.current();
726 /// assert_eq!(current, (&20, &200));
734 /// Nodes adjacent to the current node can also be removed.
749 /// let mut current = cursor.current();
750 /// assert_eq!(current, (&10, &100));
757 /// current = cursor.current();
758 /// assert_eq!(current, (&30, &300));
768 /// current = cursor.current();
769 /// assert_eq!(current, (&10, &100));
779 /// - `current` points to a node that is in the same [`RBTree`] as `tree`.
782 current: NonNull<bindings::rb_node>, field
806 /// let current = cursor.current();
807 /// assert_eq!(current, (&10, &100));
813 current: NonNull<bindings::rb_node>, field
825 /// The current node
826 pub fn current(&self) -> (&K, &V) { in current() method
828 // - `self.current` is a valid node by the type invariants. in current()
830 unsafe { Self::to_key_value(self.current) } in current()
841 // SAFETY: The passed `node` is the current node or a non-null neighbor, in to_key_value()
844 // SAFETY: The passed `node` is the current node or a non-null neighbor, in to_key_value()
870 // SAFETY: `self.current` is valid by the type invariants. in get_neighbor_raw()
873 Direction::Prev => bindings::rb_prev(self.current.as_ptr()), in get_neighbor_raw()
874 Direction::Next => bindings::rb_next(self.current.as_ptr()), in get_neighbor_raw()
894 /// The current node.
895 pub fn current(&self) -> (&K, &V) { in current() method
897 // - `self.current` is a valid node by the type invariants. in current()
899 unsafe { Self::to_key_value(self.current) } in current()
902 /// The current node, with a mutable value
905 // - `self.current` is a valid node by the type invariants. in current_mut()
907 unsafe { Self::to_key_value_mut(self.current) } in current_mut()
910 /// Remove the current node from the tree.
920 let this = unsafe { container_of!(self.current.as_ptr(), Node<K, V>, links) }; in remove_current()
929 // - `current` is a valid node in the [`RBTree`] pointed to by `self.tree`. in remove_current()
930 let cursor = next.or(prev).map(|current| Self { in remove_current()
931 current, in remove_current()
979 current: neighbor, in mv()
1022 // SAFETY: `self.current` is valid by the type invariants. in get_neighbor_raw()
1025 Direction::Prev => bindings::rb_prev(self.current.as_ptr()), in get_neighbor_raw()
1026 Direction::Next => bindings::rb_next(self.current.as_ptr()), in get_neighbor_raw()
1063 // SAFETY: The passed `node` is the current node or a non-null neighbor, in to_key_value_raw()
1066 // SAFETY: The passed `node` is the current node or a non-null neighbor, in to_key_value_raw()
1401 /// Swap the current node for the provided node.