Lines Matching full:first
36 /// * If the list is empty, then `first` is null. Otherwise, `first` points at the `ListLinks`
37 /// field of the first element in the list.
42 first: *mut ListLinksFields, field
241 first: ptr::null_mut(), in new()
248 self.first.is_null() in is_empty()
253 /// Returns a pointer to the newly inserted element. Never changes `self.first` unless the list
285 self.first = item; in insert_inner()
307 // * `self.first` is null or in the list. in push_back()
308 // * `self.first` is only null if the list is empty. in push_back()
309 unsafe { self.insert_inner(item, self.first) }; in push_back()
315 // * `self.first` is null or in the list. in push_front()
316 // * `self.first` is only null if the list is empty. in push_front()
317 let new_elem = unsafe { self.insert_inner(item, self.first) }; in push_front()
320 self.first = new_elem; in push_front()
325 if self.first.is_null() { in pop_back()
330 let last = unsafe { (*self.first).prev }; in pop_back()
335 /// Removes the first item from this list.
337 if self.first.is_null() { in pop_front()
341 // SAFETY: The first item of this list is in this list. in pop_front()
342 Some(unsafe { self.remove_internal(self.first) }) in pop_front()
434 // * If `item` was not the first item, then `self.first` should remain unchanged. in remove_internal_inner()
435 // * If `item` was the first item and there is another item, then we just updated in remove_internal_inner()
436 // `prev->next` to `next`, which is the new first item, and setting `item->next` to null in remove_internal_inner()
439 // `item->next` to null, so this correctly sets `first` to null now that the list is in remove_internal_inner()
441 if self.first == item { in remove_internal_inner()
445 self.first = unsafe { (*prev).next }; in remove_internal_inner()
462 // First, we insert the elements into `self`. At the end, we make `other` empty. in push_all_back()
465 self.first = other.first; in push_all_back()
467 let other_first = other.first; in push_all_back()
470 let self_first = self.first; in push_all_back()
476 // update `self.first` because the first element of `self` does not change. in push_all_back()
486 other.first = ptr::null_mut(); in push_all_back()
489 /// Returns a cursor that points before the first element of the list.
491 // INVARIANT: `self.first` is in this list. in cursor_front()
493 next: self.first, in cursor_front()
510 // at the first element of the same list. in iter()
512 current: self.first, in iter()
513 stop: self.first, in iter()
539 /// * The `stop` pointer is equal to the `first` field of that [`List`].
619 /// // Use a cursor to remove the first element with the given value.
731 let first = self.list.first; in prev_ptr() localVariable
732 if next == first { in prev_ptr()
733 // We are before the first element. in prev_ptr()
739 // the same as `(*first).prev`. in prev_ptr()
740 next = first; in prev_ptr()
743 // SAFETY: `next` can't be null, because then `first` must also be null, but in that case in prev_ptr()
744 // we would have exited at the `next == first` check. Thus, `next` is an element in the in prev_ptr()
794 if next == self.list.first { in move_next()
805 /// If the cursor is before the first element, then this call does nothing. This call returns
808 if self.next == self.list.first { in move_prev()
820 self.list.first in insert_inner()
826 // * if `ptr` is null, then `self.list.first` is null so the list is empty. in insert_inner()
828 if self.next == self.list.first { in insert_inner()
830 self.list.first = item; in insert_inner()
907 // access requires first releasing the immutable borrow on the `CursorPeek`. in arc()
933 // requires first releasing the immutable borrow on the `CursorPeek`. in deref()