Lines Matching defs:data
750 let mut data = vec![0; 1000];
753 let tmp = std::mem::take(&mut data);
756 data = black_box(to_extend);
759 black_box(data);
1002 let mut data = vec![0; 1000];
1005 let tmp = std::mem::take(&mut data);
1006 data = black_box(
1019 let mut data = vec![0u8; 1000];
1025 let tmp = std::mem::take(&mut data);
1032 data = black_box(mangled);
1038 let mut data = vec![0u8; 256];
1044 data.iter_mut().enumerate().for_each(|(i, d)| {
1049 black_box(data);
1094 let data = black_box([0; LEN]);
1095 b.iter(|| data.iter().cloned().chain([1].iter().cloned()).collect::<Vec<_>>());
1100 let data = black_box([0; LEN]);
1102 data.iter()
1112 let data = black_box([0; LEN]);
1114 data.iter().cloned().chain([1].iter().chain([2].iter()).cloned()).collect::<Vec<_>>()
1125 let data = black_box([0; LEN]);
1127 let mut v = Vec::<u32>::with_capacity(data.len() + 1);
1128 v.extend(data.iter().chain([1].iter()));
1135 let data = black_box([0; LEN]);
1137 let mut v = Vec::<u32>::with_capacity(data.len() + 1);
1138 v.extend(data.iter().cloned().chain(Some(1)));
1145 let data = black_box([0; LEN]);
1148 v.extend(data.iter().rev());
1155 let data = black_box([0; LEN]);
1157 let mut v = Vec::<u32>::with_capacity(data.len());
1158 v.extend(data.iter().rev());
1165 let data = black_box([(0, 0); LEN]);
1168 v.extend(data.iter().map(|t| t.1));
1175 let data = black_box([(0, 0); LEN]);
1177 let mut result = Vec::with_capacity(data.len());
1178 for i in 0..data.len() {
1180 *result.get_unchecked_mut(i) = data[i].0;
3531 let data = "ประเทศไทย中";
3532 let s: String = data.chars().collect();
3533 assert_eq!(data, s);
3538 let data = String::from("asdf");
3539 let buf = data.into_bytes();
3549 let data = "abcabc";
3550 assert_eq!(data[0..6].find("ab"), Some(0));
3551 assert_eq!(data[2..6].find("ab"), Some(3 - 2));
3552 assert!(data[2..4].find("ab").is_none());
3555 let mut data = String::from(string);
3556 data.push_str(string);
3557 assert!(data.find("ไท华").is_none());
3558 assert_eq!(data[0..43].find(""), Some(0));
3559 assert_eq!(data[6..43].find(""), Some(6 - 6));
3561 assert_eq!(data[0..43].find("ประ"), Some(0));
3562 assert_eq!(data[0..43].find("ทศไ"), Some(12));
3563 assert_eq!(data[0..43].find("ย中"), Some(24));
3564 assert_eq!(data[0..43].find("iệt"), Some(34));
3565 assert_eq!(data[0..43].find("Nam"), Some(40));
3567 assert_eq!(data[43..86].find("ประ"), Some(43 - 43));
3568 assert_eq!(data[43..86].find("ทศไ"), Some(55 - 43));
3569 assert_eq!(data[43..86].find("ย中"), Some(67 - 43));
3570 assert_eq!(data[43..86].find("iệt"), Some(77 - 43));
3571 assert_eq!(data[43..86].find("Nam"), Some(83 - 43));
3769 let data = "ประเทศไทย中华";
3774 assert_eq!(data.replace(a, repl), a2);
3779 let data = "ประเทศไทย中华";
3784 assert_eq!(data.replace(b, repl), b2);
3789 let data = "ประเทศไทย中华";
3794 assert_eq!(data.replace(c, repl), c2);
3799 let data = "ประเทศไทย中华";
3803 assert_eq!(data.replace(d, repl), data);
3808 let data = "abcdαβγδabcdαβγδ";
3809 assert_eq!(data.replace("dαβ", "???"), "abc???γδabc???γδ");
3810 assert_eq!(data.replace('γ', "???"), "abcdαβ???δabcdαβ???δ");
3811 assert_eq!(data.replace(&['a', 'γ'] as &[_], "???"), "???bcdαβ???δ???bcdαβ???δ");
3812 assert_eq!(data.replace(|c| c == 'γ', "???"), "abcdαβ???δabcdαβ???δ");
3890 data: $data:expr;
3899 good: data[$good:expr] == $output:expr;
3902 bad: data[$bad:expr];
3909 let mut v: String = $data.into();
3927 let v: String = $data.into();
3935 let mut v: String = $data.into();
3972 let data = "ประเทศไทย中华";
3973 assert_range_eq!(data, 0..3, "ป");
3974 assert_range_eq!(data, 3..6, "ร");
3975 assert_range_eq!(data, 3..3, "");
3976 assert_range_eq!(data, 30..33, "华");
4035 data: "abcdef";
4036 good: data[6..] == "";
4037 bad: data[7..];
4042 data: "abcdef";
4043 good: data[..6] == "abcdef";
4044 bad: data[..7];
4049 data: "abcdef";
4050 good: data[..=5] == "abcdef";
4051 bad: data[..=6];
4056 data: "abcdef";
4057 good: data[0..=5] == "abcdef";
4058 bad: data[0..=6];
4063 data: "abcdef";
4064 good: data[6..6] == "";
4065 bad: data[7..7];
4070 data: "abcdef";
4071 good: data[6..=5] == "";
4072 bad: data[7..=6];
4079 data: "abcdef";
4081 good: data[0..=5] == "abcdef";
4082 good: data[{
4090 bad: data[{
4101 data: "abcdef";
4102 good: data[4..4] == "";
4103 bad: data[4..3];
4108 data: "abcdef";
4109 good: data[4..=3] == "";
4110 bad: data[4..=2];
4118 data: "hello";
4121 bad: data[0..=usize::MAX];
4126 data: "hello";
4127 bad: data[..=usize::MAX];
4148 data: super::DATA;
4149 bad: data[super::BAD_START..super::GOOD_END];
4155 data: super::DATA;
4156 bad: data[super::GOOD_START..super::BAD_END];
4162 data: super::DATA;
4163 bad: data[super::BAD_START..];
4169 data: super::DATA;
4170 bad: data[..super::BAD_END];
4176 data: super::DATA;
4177 bad: data[super::BAD_START..=super::GOOD_END_INCL];
4183 data: super::DATA;
4184 bad: data[super::GOOD_START..=super::BAD_END_INCL];
4190 data: super::DATA;
4191 bad: data[..=super::BAD_END_INCL];
4383 let mut data = [0; 128];
4384 data[i] = 0xC0;
4385 assert!(from_utf8(&data).is_err());
4386 data[i] = 0xC2;
4387 assert!(from_utf8(&data).is_err());
4484 let data = "ประเทศไทย中华Việt Nam";
4485 assert!(data.contains("ประเ"));
4486 assert!(data.contains("ะเ"));
4487 assert!(data.contains("中华"));
4488 assert!(!data.contains("ไท华"));
4775 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
4777 let split: Vec<&str> = data.splitn(4, ' ').collect();
4780 let split: Vec<&str> = data.splitn(4, |c: char| c == ' ').collect();
4784 let split: Vec<&str> = data.splitn(4, 'ä').collect();
4787 let split: Vec<&str> = data.splitn(4, |c: char| c == 'ä').collect();
4793 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
4795 let split: Vec<&str> = data.split('\n').collect();
4798 let split: Vec<&str> = data.split_terminator('\n').collect();
4804 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
4806 let split: Vec<&str> = data.split_inclusive('\n').collect();
4823 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
4825 let split: Vec<&str> = data.split_inclusive('\n').rev().collect();
4847 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
4849 let split: Vec<&str> = data.rsplit(' ').collect();
4852 let split: Vec<&str> = data.rsplit("lämb").collect();
4855 let split: Vec<&str> = data.rsplit(|c: char| c == 'ä').collect();
4861 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
4863 let split: Vec<&str> = data.rsplitn(2, ' ').collect();
4866 let split: Vec<&str> = data.rsplitn(2, "lämb").collect();
4869 let split: Vec<&str> = data.rsplitn(2, |c: char| c == 'ä').collect();
4899 let data = "\n \tMäry häd\tä little lämb\nLittle lämb\n";
4900 let words: Vec<&str> = data.split_whitespace().collect();
4906 let data = "\nMäry häd ä little lämb\n\r\nLittle lämb\n";
4907 let lines: Vec<&str> = data.lines().collect();
4910 let data = "\r\nMäry häd ä little lämb\n\nLittle lämb"; // no trailing \n
4911 let lines: Vec<&str> = data.lines().collect();
4977 let data = "aabcdaa";
4978 assert!(data.contains("bcd"));
4979 assert!(data.contains(&"bcd"));
4980 assert!(data.contains(&"bcd".to_string()));
4985 let data = "aä中!";
4986 let vec: Vec<_> = data.match_indices("").collect();
5031 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
5033 let mut split: Vec<&str> = data.rsplitn(4, ' ').collect();
5037 let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == ' ').collect();
5042 let mut split: Vec<&str> = data.rsplitn(4, 'ä').collect();
5046 let mut split: Vec<&str> = data.rsplitn(4, |c: char| c == 'ä').collect();
5053 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
5055 let split: Vec<&str> = data.split(' ').collect();
5058 let mut rsplit: Vec<&str> = data.split(' ').rev().collect();
5062 let split: Vec<&str> = data.split(|c: char| c == ' ').collect();
5065 let mut rsplit: Vec<&str> = data.split(|c: char| c == ' ').rev().collect();
5070 let split: Vec<&str> = data.split('ä').collect();
5073 let mut rsplit: Vec<&str> = data.split('ä').rev().collect();
5077 let split: Vec<&str> = data.split(|c: char| c == 'ä').collect();
5080 let mut rsplit: Vec<&str> = data.split(|c: char| c == 'ä').rev().collect();
5087 let data = "\nMäry häd ä little lämb\nLittle lämb\n";
5089 let mut split: Vec<&str> = data.split('\n').rev().collect();
5093 let mut split: Vec<&str> = data.split_terminator('\n').rev().collect();
5197 let data = String::from("hello HELLO hello HELLO yes YES 5 中ä华!!!");
5198 let data2 = data.clone().into_boxed_str().clone().into_string();
5200 assert_eq!(data, data2);
5854 let mut data = String::from("ประเทศไทย中");
5855 data.push('华');
5856 data.push('b'); // 1 byte
5857 data.push('¢'); // 2 byte
5858 data.push('€'); // 3 byte
5859 data.push('?'); // 4 byte
5860 assert_eq!(data, "ประเทศไทย中华b¢€?");
5865 let mut data = String::from("ประเทศไทย中华b¢€?");
5866 assert_eq!(data.pop().unwrap(), '?'); // 4 bytes
5867 assert_eq!(data.pop().unwrap(), '€'); // 3 bytes
5868 assert_eq!(data.pop().unwrap(), '¢'); // 2 bytes
5869 assert_eq!(data.pop().unwrap(), 'b'); // 1 bytes
5870 assert_eq!(data.pop().unwrap(), '华');
5871 assert_eq!(data, "ประเทศไทย中");
7859 let mut data: Vec<Check> = (0..check_count)
7876 let drain = data.drain_filter(filter);
7911 let mut data: Vec<Check> = (0..check_count)
7928 let _drain = data.drain_filter(filter);
8289 // which is incorrect for fat pointers since `<*mut T>::is_null` only looks at the data component.
8308 fn ptr_from_raw_parts(data: *mut (), vtable: *mut ()) -> *mut dyn Fn() {
8309 unsafe { std::mem::transmute::<DynRepr, *mut dyn Fn()>(DynRepr { data, vtable }) }
8314 data: *mut (),
10720 let data = vec![vec![0, 1], vec![0], vec![1]];
10721 let data2 = data.clone().into_boxed_slice().clone().to_vec();
10723 assert_eq!(data, data2);
13291 let data = vec![5, 9, 3];
13293 let heap = BinaryHeap::from(data);
13303 let data = vec![5, 9, 3];
13305 let pq = BinaryHeap::from(data);
13313 let data = vec![5, 9, 3];
13315 let pq = BinaryHeap::from(data);
13323 let data = vec![5, 9];
13324 let pq = BinaryHeap::from(data);
13340 let data = vec![5, 9, 3];
13342 let pq = BinaryHeap::from(data);
13409 let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
13410 let mut sorted = data.clone();
13412 let mut heap = BinaryHeap::from(data);
13421 let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
13422 let mut heap = BinaryHeap::from(data);
13433 let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
13434 let mut heap = BinaryHeap::from(data);
13488 fn check_to_vec(mut data: Vec<i32>) {
13489 let heap = BinaryHeap::from(data.clone());
13492 data.sort();
13494 assert_eq!(v, data);
13495 assert_eq!(heap.into_sorted_vec(), data);
13730 // don't use 0 in the data -- we want to catch the zeroed-out case.
13731 let data = (1..=DATASZ).collect::<Vec<_>>();
13739 data.iter().filter(|&&x| x != i).map(|&x| PanicOrd(x, false)).collect();
13768 assert_eq!(data_sorted, data);
14450 /// involved. This type is excellent for building your own data structures like Vec and VecDeque.
15216 /// `replace` creates a new [`String`], and copies the data from this string slice into it.
15254 /// `replacen` creates a new [`String`], and copies the data from this string slice into it.
16351 /// uses to store its data. The length is the number of bytes currently stored
16366 /// // Prevent automatically dropping the String's data
16520 /// data. If you have an idea of how much data the `String` will hold,
16542 /// `String`s have an internal buffer to hold their data. The capacity is
16546 /// appending a bunch of data to the `String`, reducing the number of
16743 /// if `v` contains any invalid data.
16777 /// invalid data with [the replacement character (`U+FFFD`)][U+FFFD].
16808 /// Returns the raw pointer to the underlying data, the length of
16809 /// the string (in bytes), and the allocated capacity of the data
16851 /// internal data structures.
16870 /// // Prevent automatically dropping the String's data
17129 /// fn process_data(data: &str) -> Result<String, TryReserveError> {
17133 /// output.try_reserve(data.len())?;
17136 /// output.push_str(data);
17167 /// fn process_data(data: &str) -> Result<String, TryReserveError> {
17171 /// output.try_reserve(data.len())?;
17174 /// output.push_str(data);
17745 // of the vector version. The data is just plain bytes.
17790 // of the vector version. The data is just plain bytes.
18816 //! A module for working with borrowed data.
18843 /// A generalization of `Clone` to borrowed data.
18847 /// to `T`. The `ToOwned` trait generalizes `Clone` to construct owned data
18856 /// Creates owned data from borrowed data, usually by cloning.
18873 /// Uses borrowed data to replace owned data, usually by cloning.
18913 /// can enclose and provide immutable access to borrowed data, and clone the
18914 /// data lazily when mutation or ownership is required. The type is designed to
18915 /// work with general borrowed data via the `Borrow` trait.
18918 /// non-mutating methods directly on the data it encloses. If mutation
18981 /// // Mutates the data from slice into owned vec and pushes a new value on top
18985 /// // The data was mutated. Let check it out.
18987 /// Items { values: Cow::Owned(_) } => println!("clone_on_write contains owned data"),
18988 /// _ => panic!("expect owned data"),
18996 /// Borrowed data.
19000 /// Owned data.
19026 /// Returns true if the data is borrowed, i.e. if `to_mut` would require additional work.
19049 /// Returns true if the data is owned, i.e. if `to_mut` would be a no-op.
19069 /// Acquires a mutable reference to the owned form of the data.
19071 /// Clones the data if it is not already owned.
19100 /// Extracts the owned data.
19102 /// Clones the data if it is not already owned.
19106 /// Calling `into_owned` on a `Cow::Borrowed` clones the underlying data
19317 //! is the same as that of a pointer. Tree-like data structures are often built
19337 //! This type allows for shared access to the contained data, and is often
19343 //! Implementations of the most common general purpose data structures are
19892 let data = data_fn(&weak);
19896 ptr::write(ptr::addr_of_mut!((*inner).value), data);
20279 /// Provides a raw pointer to the data.
20591 /// let mut data = Rc::new(5);
20593 /// *Rc::make_mut(&mut data) += 1; // Won't clone anything
20594 /// let mut other_data = Rc::clone(&data); // Won't clone inner data
20595 /// *Rc::make_mut(&mut data) += 1; // Clones inner data
20596 /// *Rc::make_mut(&mut data) += 1; // Won't clone anything
20599 /// // Now `data` and `other_data` point to different allocations.
20600 /// assert_eq!(*data, 8);
20609 /// let mut data = Rc::new(75);
20610 /// let weak = Rc::downgrade(&data);
20612 /// assert!(75 == *data);
20615 /// *Rc::make_mut(&mut data) += 1;
20617 /// assert!(76 == *data);
20624 // Gotta clone the data, there are other Rcs.
20628 let data = Rc::get_mut_unchecked(&mut rc);
20629 (**this).write_clone_into_raw(data.as_mut_ptr());
20633 // Can just steal the data, all that's left is Weaks
20636 let data = Rc::get_mut_unchecked(&mut rc);
20637 data.as_mut_ptr().copy_from_nonoverlapping(&**this, 1);
20691 /// The function `mem_to_rcbox` is called with the data pointer
20713 /// The function `mem_to_rcbox` is called with the data pointer
21490 /// making any assertions about the data field.
21699 // We are careful to *not* create a reference covering the "data" field, as
21701 // is dropped, the data field will be dropped in-place).
22643 // Extension traits for slices over specific kinds of data
22818 // However, this way we copy data around more than is necessary. If elements are big
22827 // preceding it. Finally, copy data from the temporary variable into the remaining
23138 /// [`RawWaker`]. It supports the common executor design in which the data used
23362 /// data, but it doesn't add thread safety to its data. Consider
23447 /// Sharing some immutable data between threads:
23581 data: T,
23599 pub fn new(data: T) -> Arc<T> {
23605 data,
23638 data: mem::MaybeUninit::<T>::uninit(),
23651 let data = data_fn(&weak);
23657 ptr::write(ptr::addr_of_mut!((*inner).data), data);
23659 // The above write to the data field must be visible to any threads which
23747 /// `data` will be pinned in memory and unable to be moved.
23749 pub fn pin(data: T) -> Pin<Arc<T>> {
23750 unsafe { Pin::new_unchecked(Arc::new(data)) }
23766 pub fn try_new(data: T) -> Result<Arc<T>, AllocError> {
23772 data,
23873 let elem = ptr::read(&this.ptr.as_ref().data);
24050 /// Provides a raw pointer to the data.
24073 unsafe { ptr::addr_of_mut!((*ptr).data) }
24298 // `ArcInner` structure itself is `Sync` because the inner data is
24307 // Destroy the data at this time, even though we may not free the box
24343 /// The function `mem_to_arcinner` is called with the data pointer
24365 /// The function `mem_to_arcinner` is called with the data pointer
24415 &mut (*ptr).data as *mut _ as *mut u8,
24446 ptr::copy_nonoverlapping(v.as_ptr(), &mut (*ptr).data as *mut [T] as *mut T, v.len());
24484 let elems = &mut (*ptr).data as *mut [T] as *mut T;
24574 &self.inner().data
24602 /// let mut data = Arc::new(5);
24604 /// *Arc::make_mut(&mut data) += 1; // Won't clone anything
24605 /// let mut other_data = Arc::clone(&data); // Won't clone inner data
24606 /// *Arc::make_mut(&mut data) += 1; // Clones inner data
24607 /// *Arc::make_mut(&mut data) += 1; // Won't clone anything
24610 /// // Now `data` and `other_data` point to different allocations.
24611 /// assert_eq!(*data, 8);
24630 let data = Arc::get_mut_unchecked(&mut arc);
24631 (**this).write_clone_into_raw(data.as_mut_ptr());
24651 // Can just steal the data, all that's left is Weaks
24654 let data = Arc::get_mut_unchecked(&mut arc);
24655 data.as_mut_ptr().copy_from_nonoverlapping(&**this, 1);
24703 // reference to the inner data.
24742 unsafe { &mut (*this.ptr.as_ptr()).data }
24746 /// the underlying data.
24810 // This fence is needed to prevent reordering of use of the data and
24811 // deletion of the data. Because it is marked `Release`, the decreasing
24813 // means that use of the data happens before decreasing the reference
24815 // deletion of the data.
24902 /// making any assertions about the data field.
24946 unsafe { ptr::addr_of_mut!((*ptr).data) }
25151 // We are careful to *not* create a reference covering the "data" field, as
25153 // is dropped, the data field will be dropped in-place).
25293 // deallocate the data entirely. See the discussion in Arc::drop() about
34991 let mut data = rand_data(173);
34993 let mut set = BTreeSet::from_iter(data.clone());
34994 let right = set.split_off(&(data.iter().max().unwrap() + 1));
34996 data.sort();
34997 assert!(set.into_iter().eq(data));
35003 let mut data = rand_data(314);
35005 let mut set = BTreeSet::from_iter(data.clone());
35006 let right = set.split_off(data.iter().min().unwrap());
35008 data.sort();
35010 assert!(right.into_iter().eq(data));
35016 let mut data = if cfg!(miri) { rand_data(529) } else { rand_data(1529) };
35018 data.sort();
35020 let mut set = BTreeSet::from_iter(data.clone());
35021 let key = data[data.len() / 2];
35024 assert!(set.into_iter().eq(data.clone().into_iter().filter(|x| *x < key)));
35025 assert!(right.into_iter().eq(data.into_iter().filter(|x| *x >= key)));
35031 let mut data = 1;
35033 let mut rr = &mut data;
35044 assert_eq!(data, 42);
37545 let mut data = rand_data(173);
37547 let mut map = BTreeMap::from_iter(data.clone());
37548 let right = map.split_off(&(data.iter().max().unwrap().0 + 1));
37552 data.sort();
37553 assert!(map.into_iter().eq(data));
37559 let mut data = rand_data(314);
37561 let mut map = BTreeMap::from_iter(data.clone());
37562 let right = map.split_off(&data.iter().min().unwrap().0);
37566 data.sort();
37568 assert!(right.into_iter().eq(data));
37607 let mut data = Vec::from_iter((0..len).map(|_| (rng.next(), ())));
37609 let mut map = BTreeMap::from_iter(data.iter().copied());
37610 data.sort();
37611 let small_keys = data.iter().take(len / 2).map(|kv| kv.0);
37612 let large_keys = data.iter().skip(len / 2).map(|kv| kv.0);
37625 let mut data = if cfg!(miri) { rand_data(529) } else { rand_data(1529) };
37627 data.sort();
37629 let mut map = BTreeMap::from_iter(data.clone());
37630 let key = data[data.len() / 2].0;
37635 assert!(map.into_iter().eq(data.clone().into_iter().filter(|x| x.0 < key)));
37636 assert!(right.into_iter().eq(data.into_iter().filter(|x| x.0 >= key)));
37952 // since leaf edges are empty and need no data representation. In an internal node,
37983 /// The arrays storing the actual data of the node. Only the first `len` elements of each
38019 data: LeafNode<K, V>,
38037 // We only need to initialize the data; the edges are MaybeUninit.
38038 LeafNode::init(ptr::addr_of_mut!((*node.as_mut_ptr()).data));
38173 /// Exposes the data of an internal node.
38183 /// Borrows exclusive access to the data of an internal node.
38973 /// by taking care of leaf data.
39042 let kv = self.split_leaf_data(&mut new_node.data);
39043 let new_len = usize::from(new_node.data.len);
39282 // Move leaf data.
39345 // Move leaf data.
40443 // to where data should be written.
41024 /// fn process_data(data: &[u32]) -> Result<VecDeque<u32>, TryReserveError> {
41028 /// output.try_reserve_exact(data.len())?;
41031 /// output.extend(data.iter().map(|&val| {
41062 /// fn process_data(data: &[u32]) -> Result<VecDeque<u32>, TryReserveError> {
41066 /// output.try_reserve(data.len())?;
41069 /// output.extend(data.iter().map(|&val| {
41548 // When finished, the remaining data will be copied back to cover the hole,
43241 /// This never needs to re-allocate, but does need to do *O*(*n*) data movement if
43256 /// // This one needs data rearranging.
44519 data: Vec<T>,
44538 f.debug_tuple("PeekMut").field(&self.heap.data[0]).finish()
44558 unsafe { self.heap.data.get_unchecked(0) }
44568 unsafe { self.heap.data.get_unchecked_mut(0) }
44585 BinaryHeap { data: self.data.clone() }
44589 self.data.clone_from(&source.data);
44623 BinaryHeap { data: vec![] }
44642 BinaryHeap { data: Vec::with_capacity(capacity) }
44700 self.data.pop().map(|mut item| {
44702 swap(&mut item, &mut self.data[0]);
44745 self.data.push(item);
44778 let ptr = self.data.as_mut_ptr();
44804 let mut hole = unsafe { Hole::new(&mut self.data, pos) };
44832 let mut hole = unsafe { Hole::new(&mut self.data, pos) };
44891 let mut hole = unsafe { Hole::new(&mut self.data, pos) };
44922 /// Rebuild assuming data[0..start] is still a proper heap.
44996 let start = self.data.len();
44998 self.data.append(&mut other.data);
45057 self.data.retain(|e| {
45065 // data[0..first_removed] is untouched, so we only need to rebuild the tail:
45089 Iter { iter: self.data.iter() }
45134 self.data.get(0)
45151 self.data.capacity()
45180 self.data.reserve_exact(additional);
45203 self.data.reserve(additional);
45222 self.data.shrink_to_fit();
45246 self.data.shrink_to(min_capacity)
45267 self.data.as_slice()
45307 self.data.len()
45356 Drain { iter: self.data.drain(..) }
45386 data: &'a mut [T],
45394 /// Unsafe because pos must be within the data slice.
45396 unsafe fn new(data: &'a mut [T], pos: usize) -> Self {
45397 debug_assert!(pos < data.len());
45399 let elt = unsafe { ptr::read(data.get_unchecked(pos)) };
45400 Hole { data, elt: ManuallyDrop::new(elt), pos }
45416 /// Unsafe because index must be within the data slice and not equal to pos.
45420 debug_assert!(index < self.data.len());
45421 unsafe { self.data.get_unchecked(index) }
45426 /// Unsafe because index must be within the data slice and not equal to pos.
45430 debug_assert!(index < self.data.len());
45432 let ptr = self.data.as_mut_ptr();
45447 ptr::copy_nonoverlapping(&*self.elt, self.data.get_unchecked_mut(pos), 1);
45728 let mut heap = BinaryHeap { data: vec };
45738 /// This conversion requires no data movement or allocation, and has
45741 heap.data
45776 IntoIter { iter: self.data.into_iter() }
46611 // When it has been advanced We can also reuse the memory and move the data to the front.
47152 /// `Vec` will not specifically overwrite any data that is removed from it,
47156 /// removed data to be erased for security purposes. Even if you drop a `Vec`, its
47270 /// internal data structures. For example it is **not** safe
47408 /// internal data structures. For example it is **not** safe
47469 /// Returns the raw pointer to the underlying data, the length of
47471 /// data (in elements). These are the same arguments in the same
47507 /// Returns the raw pointer to the underlying data, the length of the vector (in elements),
47508 /// the allocated capacity of the data (in elements), and the allocator. These are the same
47634 /// fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
47638 /// output.try_reserve(data.len())?;
47641 /// output.extend(data.iter().map(|&val| {
47676 /// fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
47680 /// output.try_reserve_exact(data.len())?;
47683 /// output.extend(data.iter().map(|&val| {
48723 /// This function is mainly useful for data that lives for the remainder of
48749 /// The returned slice can be used to fill the vector with data (e.g. by
48750 /// reading from a file) before marking the data as initialized using the
48793 /// The returned spare capacity slice can be used to fill the vector with data
48794 /// (e.g. by reading from a file) before marking the data as initialized using
48800 /// optimization purposes. If you need to append data to a `Vec`
49709 // that the optimizer will see does not alias with any stores through the Vec's data
50194 //! Creating a recursive data structure:
51115 /// This function is mainly useful for data that lives for the remainder of
51137 /// Unsized data:
51252 // this makes a copy of the data