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.
39 first: *mut ListLinksFields, field
238 first: ptr::null_mut(), in new()
245 self.first.is_null() in is_empty()
262 if self.first.is_null() { in push_back()
263 self.first = item; in push_back()
271 let next = self.first; in push_back()
302 if self.first.is_null() { in push_front()
310 let next = self.first; in push_front()
323 self.first = item; in push_front()
328 if self.first.is_null() { in pop_back()
333 let last = unsafe { (*self.first).prev }; in pop_back()
338 /// Removes the first item from this list.
340 if self.first.is_null() { in pop_front()
344 // SAFETY: The first item of this list is in this list. in pop_front()
345 Some(unsafe { self.remove_internal(self.first) }) in pop_front()
436 // * If `item` was not the first item, then `self.first` should remain unchanged. in remove_internal_inner()
437 // * If `item` was the first item and there is another item, then we just updated in remove_internal_inner()
438 // `prev->next` to `next`, which is the new first item, and setting `item->next` to null in remove_internal_inner()
441 // `item->next` to null, so this correctly sets `first` to null now that the list is in remove_internal_inner()
443 if self.first == item { in remove_internal_inner()
447 self.first = unsafe { (*prev).next }; in remove_internal_inner()
464 // First, we insert the elements into `self`. At the end, we make `other` empty. in push_all_back()
467 self.first = other.first; in push_all_back()
469 let other_first = other.first; in push_all_back()
472 let self_first = self.first; in push_all_back()
478 // update `self.first` because the first element of `self` does not change. in push_all_back()
488 other.first = ptr::null_mut(); in push_all_back()
491 /// Returns a cursor to the first element of the list.
495 if self.first.is_null() { in cursor_front()
499 current: self.first, in cursor_front()
508 // at the first element of the same list. in iter()
510 current: self.first, in iter()
511 stop: self.first, in iter()
537 /// * The `stop` pointer is equal to the `first` field of that [`List`].
600 // mutable access requires first releasing the immutable borrow on the cursor. in current()
611 if next == self.list.first { in next()
628 if self.current == self.list.first { in prev()