Lines Matching full:first

33 /// * If the list is empty, then `first` is null. Otherwise, `first` points at the `ListLinks`
34 /// field of the first element in the list.
264 first: *mut ListLinksFields, field
470 first: ptr::null_mut(), in new()
477 self.first.is_null() in is_empty()
482 /// Returns a pointer to the newly inserted element. Never changes `self.first` unless the list
514 self.first = item; in insert_inner()
536 // * `self.first` is null or in the list. in push_back()
537 // * `self.first` is only null if the list is empty. in push_back()
538 unsafe { self.insert_inner(item, self.first) }; in push_back()
544 // * `self.first` is null or in the list. in push_front()
545 // * `self.first` is only null if the list is empty. in push_front()
546 let new_elem = unsafe { self.insert_inner(item, self.first) }; in push_front()
549 self.first = new_elem; in push_front()
559 let last = unsafe { (*self.first).prev }; in pop_back()
564 /// Removes the first item from this list.
570 // SAFETY: The first item of this list is in this list. in pop_front()
571 Some(unsafe { self.remove_internal(self.first) }) in pop_front()
666 // * If `item` was not the first item, then `self.first` should remain unchanged. in remove_internal_inner()
667 // * If `item` was the first item and there is another item, then we just updated in remove_internal_inner()
668 // `prev->next` to `next`, which is the new first item, and setting `item->next` to null in remove_internal_inner()
671 // `item->next` to null, so this correctly sets `first` to null now that the list is in remove_internal_inner()
673 if self.first == item { in remove_internal_inner()
677 self.first = unsafe { (*prev).next }; in remove_internal_inner()
694 // First, we insert the elements into `self`. At the end, we make `other` empty. in push_all_back()
697 self.first = other.first; in push_all_back()
699 let other_first = other.first; in push_all_back()
702 let self_first = self.first; in push_all_back()
708 // update `self.first` because the first element of `self` does not change. in push_all_back()
718 other.first = ptr::null_mut(); in push_all_back()
721 /// Returns a cursor that points before the first element of the list.
723 // INVARIANT: `self.first` is in this list. in cursor_front()
725 next: self.first, in cursor_front()
742 // at the first element of the same list. in iter()
744 current: self.first, in iter()
745 stop: self.first, in iter()
771 /// * The `stop` pointer is equal to the `first` field of that [`List`].
848 /// // Use a cursor to remove the first element with the given value.
960 let first = self.list.first; in prev_ptr() localVariable
961 if next == first { in prev_ptr()
962 // We are before the first element. in prev_ptr()
968 // the same as `(*first).prev`. in prev_ptr()
969 next = first; in prev_ptr()
972 // SAFETY: `next` can't be null, because then `first` must also be null, but in that case in prev_ptr()
973 // we would have exited at the `next == first` check. Thus, `next` is an element in the in prev_ptr()
1023 if next == self.list.first { in move_next()
1034 /// If the cursor is before the first element, then this call does nothing. This call returns
1037 if self.next == self.list.first { in move_prev()
1049 self.list.first in insert_inner()
1055 // * if `ptr` is null, then `self.list.first` is null so the list is empty. in insert_inner()
1057 if self.next == self.list.first { in insert_inner()
1059 self.list.first = item; in insert_inner()
1136 // access requires first releasing the immutable borrow on the `CursorPeek`. in arc()
1162 // requires first releasing the immutable borrow on the `CursorPeek`. in deref()