Lines Matching defs:first

1221         black_box(vec.first());
1235 black_box(vec.first());
5189 // The only way to acquire a Box<str> in the first place is through a String, so just
9348 assert_eq!(a.first(), None);
9350 assert_eq!(a.first().unwrap(), &11);
9352 assert_eq!(a.first().unwrap(), &11);
9722 // where the first item of each tuple is random, but
9735 // Only sort on the first element, so an unstable sort
9740 // of the tuple), so elements with equal first items
12079 let first = cap / 2;
12080 let last = cap - first;
12081 for i in 0..first {
12094 let expected_right: Vec<_> = (0..first).collect();
12107 let first = cap / 2;
12108 let last = cap - first;
12109 for i in 0..first {
12122 let expected_right: Vec<_> = (0..first).collect();
13949 /// The first argument `format!` receives is a format string. This must be a string
14410 // Having allocated *first* may allow the optimizer to create
15120 // the first slice is the only one without a separator preceding it
15121 let first = match iter.next() {
15122 Some(first) => first,
15141 result.extend_from_slice(first.borrow().as_ref());
15252 /// Replaces first N matches of a pattern with another string.
16278 /// `String`s are always valid UTF-8. This has a few implications, the first of
16286 /// println!("The first letter of s is {}", s[0]); // ERROR!!!
16294 /// The [`bytes`] and [`chars`] methods return iterators over the first
16337 /// There are two options that would work instead. The first would be to
16413 /// At first, we have no memory allocated at all, but as we append to the
16848 /// * The first `length` bytes at `buf` need to be valid UTF-8.
17388 /// patterns overlap, only the first pattern will be removed:
17899 /// // the first byte is invalid here
17966 // one allocation by getting the first string from the iterator
17993 // one allocation by getting the first item and appending to it all the
18224 /// Concatenating two `String`s takes the first by value and borrows the second:
18233 /// If you want to keep using the first `String`, you can clone it and append to the clone instead:
18242 /// Concatenating `&str` slices can be done by converting the first to a `String`:
19645 //! Rust actually makes it somewhat difficult to produce this loop in the first
20831 // Pointer to first element
21348 /// In the general case, collecting into `Rc<[T]>` is done by first
21362 /// .collect::<Vec<_>>() // The first set of allocations happens here.
21724 /// let first = Rc::downgrade(&first_rc);
21727 /// assert!(first.ptr_eq(&second));
21732 /// assert!(!first.ptr_eq(&third));
21740 /// let first = Weak::new();
21742 /// assert!(first.ptr_eq(&second));
21746 /// assert!(!first.ptr_eq(&third));
22532 // first `rem` repetitions from `buf` itself.
22718 let first = match iter.next() {
22719 Some(first) => first,
22724 result.extend_from_slice(first.borrow());
22740 let first = match iter.next() {
22741 Some(first) => first,
22747 result.extend_from_slice(first.borrow());
22817 // 1. Swap adjacent elements until the first one gets to its final destination.
22821 // 2. Iterate until the right place for the first element is found. Then shift the
22825 // 3. Copy the first element into a temporary variable. Iterate until the right place
22888 // The merge process first copies the shorter run into `buf`. Then it traces the newly copied
22893 // consumed first, then we must copy whatever is left of the shorter run into the remaining
22898 // 2. Fills the remaining hole in `v` if the longer run gets consumed first.
23360 /// first: after all, isn't the point of `Arc<T>` thread safety? The key is
24483 // Pointer to first element
25176 /// let first = Arc::downgrade(&first_rc);
25179 /// assert!(first.ptr_eq(&second));
25184 /// assert!(!first.ptr_eq(&third));
25192 /// let first = Weak::new();
25194 /// assert!(first.ptr_eq(&second));
25198 /// assert!(!first.ptr_eq(&third));
25689 /// In the general case, collecting into `Arc<[T]>` is done by first
25703 /// .collect::<Vec<_>>() // The first set of allocations happens here.
25828 //! From these, you can see that the first argument is a format string. It is
25855 //! the first `{}` is seen, so it prints the first argument. Then upon reaching
26008 //! first input holds the `usize` precision, and the second holds the value to print. Note that
26025 //! // specified in first of next two args (5)}
26235 //! write! // first argument is a &mut io::Write, the destination
27279 // The split node is the new tail node of the first part and owns
27303 // Fix the tail ptr of the first part
27691 /// Adds an element first in the list.
27713 /// Removes the first element and returns it, or `None` if the list is
28117 /// the first element of the `LinkedList`. If it is pointing to the last
28139 /// the last element of the `LinkedList`. If it is pointing to the first
28170 /// the first element of the `LinkedList`. If it is pointing to the last
28186 /// the last element of the `LinkedList`. If it is pointing to the first
28214 /// the first element of the `LinkedList`. If it is pointing to the last
28236 /// the last element of the `LinkedList`. If it is pointing to the first
28267 /// the first element of the `LinkedList`. If it is pointing to the last
28283 /// the last element of the `LinkedList`. If it is pointing to the first
30127 /// drop an entire tree without the need to first look up a `back` leaf edge.
30366 /// Returns the first key-value pair in the map.
30392 /// Returns the first entry in the map for in-place manipulation.
30406 /// entry.insert("first");
30409 /// assert_eq!(*map.get(&1).unwrap(), "first");
30423 /// Removes and returns the first element in the map.
32472 if let (Some(self_min), Some(self_max)) = (self.first(), self.last()) {
32478 if let (Some(other_min), Some(other_max)) = (other.first(), other.last()) {
32561 if let (Some(self_min), Some(self_max)) = (self.first(), self.last()) {
32567 if let (Some(other_min), Some(other_max)) = (other.first(), other.last()) {
32732 if let (Some(self_min), Some(self_max)) = (self.first(), self.last()) {
32738 if let (Some(other_min), Some(other_max)) = (other.first(), other.last()) {
32808 /// Returns a reference to the first value in the set, if any.
32820 /// assert_eq!(set.first(), None);
32822 /// assert_eq!(set.first(), Some(&1));
32824 /// assert_eq!(set.first(), Some(&1));
32827 pub fn first(&self) -> Option<&T>
32860 /// Removes the first value from the set and returns it, if any.
32861 /// The first value is always the minimum value in the set.
33941 /// If the leaf edge is the first one in the tree, returns [`Result::Err`] with the root node.
34157 /// you need first when navigating forward (or last when navigating backward).
34170 /// you need last when navigating forward (or first when navigating backward).
34191 /// visits internal nodes as a whole in a depth first order, meaning that
34675 assert_eq!(set.first().unwrap().id(), 1);
34951 assert_eq!(a.first(), None);
34954 assert_eq!(a.first(), Some(&1));
34957 assert_eq!(a.first(), Some(&1));
34962 assert_eq!(a.first(), Some(&1));
35729 // - 30 elements in right child's 5 first grandchildren with 6 elements each
36053 // Descend into first child.
36055 // Descend into first child again, after running through second child.
36143 let (first, last) = (vec![all[0]], vec![all[size as usize - 1]]);
36168 assert_eq!(range_keys(&map, (Excluded(0), Excluded(2))), first);
36169 assert_eq!(range_keys(&map, (Excluded(0), Included(1))), first);
36170 assert_eq!(range_keys(&map, (Included(0), Excluded(2))), first);
36171 assert_eq!(range_keys(&map, (Included(0), Included(1))), first);
36172 assert_eq!(range_keys(&map, (Included(1), Excluded(2))), first);
36173 assert_eq!(range_keys(&map, (Included(1), Included(1))), first);
36174 assert_eq!(range_keys(&map, (Unbounded, Excluded(2))), first);
36175 assert_eq!(range_keys(&map, (Unbounded, Included(1))), first);
36222 let (first, last) = (vec![all[0]], vec![all[size as usize - 1]]);
36247 assert_eq!(range_keys(&map, (Excluded(0), Excluded(2))), first);
36248 assert_eq!(range_keys(&map, (Excluded(0), Included(1))), first);
36249 assert_eq!(range_keys(&map, (Included(0), Excluded(2))), first);
36250 assert_eq!(range_keys(&map, (Included(0), Included(1))), first);
36251 assert_eq!(range_keys(&map, (Included(1), Excluded(2))), first);
36252 assert_eq!(range_keys(&map, (Included(1), Included(1))), first);
36253 assert_eq!(range_keys(&map, (Unbounded, Excluded(2))), first);
36254 assert_eq!(range_keys(&map, (Unbounded, Included(1))), first);
36349 // Has proper order the first time asked, then flips around.
37506 left.insert(b.spawn(Panic::InDrop), ()); // first duplicate key, dropped during append
37525 map2.insert(Cyclic3::C, ()); // lands first, before A
37526 map2.insert(Cyclic3::B, ()); // lands first, before C
37571 // In a tree with 3 levels, if all but a part of the first leaf node is split off,
37983 /// The arrays storing the actual data of the node. Only the first `len` elements of each
38484 /// Removes the internal root node, using its first child as the new root node.
38502 // SAFETY: the first edge is always initialized.
38955 // invalidates the reference returned by the first.
39455 /// The first edge of `right` remains unchanged.
40442 // to the first element that could be read, Head always points
41200 /// Shortens the `VecDeque`, keeping the first `len` elements and dropping
41237 // `begin <= back.len()` in the first case
41257 // in the first one panics.
41317 /// `VecDeque` will be in the first slice and the second slice will be empty.
41352 /// `VecDeque` will be in the first slice and the second slice will be empty.
41543 // When the Drain is first created, the source deque is shortened to
41721 /// Removes the first element and returns it, or `None` if the `VecDeque` is
41829 /// replacing it with the first element.
42262 // copy first element into empty spot
42339 // `at` lies in the first half.
42352 // in the first half.
42566 // this means that we first shift the head backwards, and then
42588 // this means that we first shift the tail forwards, and then
42646 /// - Rotates item `mid` into the first position.
42647 /// - Pops the first `mid` items and pushes them to the end.
42689 /// - Rotates the first item into position `k`.
42771 /// Looks up a series of four elements. The first is found, with a
42831 /// Looks up a series of four elements. The first is found, with a
42853 let cmp_back = back.first().map(|elem| f(elem));
42885 /// their second elements. The first is found, with a uniquely
42914 /// (the index of the first element of the second partition).
42951 if let Some(true) = back.first().map(|v| pred(v)) {
44338 //! // Examine the frontier with lower cost nodes first (min-heap)
46413 // exhaust self first
46454 // Unroll the first iteration, as the vector is going to be
47158 /// first, that might not actually happen because the optimizer does not consider
47784 /// Shortens the vector, keeping the first `len` elements and dropping
48136 // Write it in, overwriting the first copy of the `index`th
48288 /// Removes all but the first of consecutive elements in the vector that resolve to the same
48312 /// Removes all but the first of consecutive elements in the vector satisfying a given equality
48368 /* Pointer to first item in vec[write..write+items_left] slice */
48370 /* Pointer to first item in vec[read..] slice */
48407 * Looks like the first option is faster. */
48542 // When the Drain is first created, it shortens the length of
48763 /// // Fill in the first 3 elements.
48769 /// // Mark the first 3 elements of the vector as being initialized.
49679 /// you can call [`.truncate(N)`](Vec::truncate) first.
50127 //! The first version of the prelude of `alloc` crate.
51117 /// leak. If this is not acceptable, the reference should first be wrapped