Lines Matching defs:insert
507 black_box(&mut x).insert(6, black_box(' '));
517 black_box(&mut x).insert(6, black_box('❤'));
1314 map.insert(i, i);
1320 map.insert(k, k);
1336 map.insert(i * 2, i * 2);
1342 map.insert(i, i);
1363 map.insert(k, k);
1388 map.insert(i, i);
1419 map.insert(rng.gen(), rng.gen());
1449 map.insert(rng.gen(), rng.gen());
1814 set.insert(rng.gen());
1837 sets[b as usize].insert(i as u32);
2190 v.insert(rng.gen::<usize>() % (l + 1), (1, 1));
5605 x.insert(1);
5606 x.insert(2);
5607 x.insert(3);
5609 y.insert(3);
5610 y.insert(2);
5611 y.insert(1);
6044 fn insert() {
6046 s.insert(0, 'ệ');
6048 s.insert(6, 'ย');
6055 "".to_string().insert(1, 't');
6060 "ệ".to_string().insert(1, 't');
8215 v.insert(1, 1);
9862 a.insert(2, 3);
9866 a.insert(0, 0);
9870 a.insert(3, 4);
9874 a.insert(0, 1);
9882 a.insert(4, 5);
16680 /// UTF-8, then we need to insert the replacement characters, which will
17520 /// s.insert(0, 'f');
17521 /// s.insert(1, 'o');
17522 /// s.insert(2, 'o');
17528 pub fn insert(&mut self, idx: usize, ch: char) {
21872 // nevertheless, we insert an abort here to hint LLVM at
21896 // nevertheless, we insert an abort here to hint LLVM at
28993 v.insert(0, -i);
29872 /// movie_reviews.insert("Office Space", "Deals with real issues in the workplace.");
29873 /// movie_reviews.insert("Pulp Fiction", "Masterpiece.");
29874 /// movie_reviews.insert("The Godfather", "Very enjoyable.");
29875 /// movie_reviews.insert("The Blues Brothers", "Eye lyked it a lot.");
29922 /// // insert a key only if it doesn't already exist
29925 /// // insert a key using a function that provides a new value only if it
30058 VacantEntry { key, handle, dormant_map, _marker: PhantomData }.insert(());
30278 /// map.insert(1, "a");
30299 /// a.insert(1, "a");
30321 /// map.insert(1, "a");
30349 /// map.insert(1, "a");
30379 /// map.insert(1, "b");
30380 /// map.insert(2, "a");
30402 /// map.insert(1, "a");
30403 /// map.insert(2, "b");
30406 /// entry.insert("first");
30435 /// map.insert(1, "a");
30436 /// map.insert(2, "b");
30462 /// map.insert(1, "b");
30463 /// map.insert(2, "a");
30485 /// map.insert(1, "a");
30486 /// map.insert(2, "b");
30489 /// entry.insert("last");
30518 /// map.insert(1, "a");
30519 /// map.insert(2, "b");
30546 /// map.insert(1, "a");
30572 /// map.insert(1, "a");
30601 /// [module-level documentation]: index.html#insert-and-complex-keys
30611 /// assert_eq!(map.insert(37, "a"), None);
30614 /// map.insert(37, "b");
30615 /// assert_eq!(map.insert(37, "c"), Some("b"));
30619 pub fn insert(&mut self, key: K, value: V) -> Option<V>
30624 Occupied(mut entry) => Some(entry.insert(value)),
30626 entry.insert(value);
30632 /// Tries to insert a key-value pair into the map, and returns
30662 Vacant(entry) => Ok(entry.insert(value)),
30680 /// map.insert(1, "a");
30708 /// map.insert(1, "a");
30760 /// a.insert(1, "a");
30761 /// a.insert(2, "b");
30762 /// a.insert(3, "c");
30765 /// b.insert(3, "d");
30766 /// b.insert(4, "e");
30767 /// b.insert(5, "f");
30823 /// map.insert(3, "a");
30824 /// map.insert(5, "b");
30825 /// map.insert(8, "c");
30912 // FIXME(@porglezomp) Avoid allocating if we don't insert
30934 /// a.insert(1, "a");
30935 /// a.insert(2, "b");
30936 /// a.insert(3, "c");
30937 /// a.insert(17, "d");
30938 /// a.insert(41, "e");
31041 /// a.insert(2, "b");
31042 /// a.insert(1, "a");
31064 /// a.insert(1, "hello");
31065 /// a.insert(2, "goodbye");
31733 self.insert(k, v);
31739 self.insert(k, v);
31751 self.insert(k, v);
31835 /// map.insert(3, "c");
31836 /// map.insert(2, "b");
31837 /// map.insert(1, "a");
31867 /// map.insert("a", 1);
31868 /// map.insert("b", 2);
31869 /// map.insert("c", 3);
31905 /// a.insert(2, "b");
31906 /// a.insert(1, "a");
31926 /// a.insert(1, "hello");
31927 /// a.insert(2, "goodbye");
31947 /// a.insert(1, String::from("hello"));
31948 /// a.insert(2, String::from("goodbye"));
31974 /// a.insert(1, "a");
31995 /// a.insert(1, "a");
32209 /// books.insert("A Dance With Dragons");
32210 /// books.insert("To Kill a Mockingbird");
32211 /// books.insert("The Odyssey");
32212 /// books.insert("The Great Gatsby");
32428 /// set.insert(3);
32429 /// set.insert(5);
32430 /// set.insert(8);
32456 /// a.insert(1);
32457 /// a.insert(2);
32460 /// b.insert(2);
32461 /// b.insert(3);
32517 /// a.insert(1);
32518 /// a.insert(2);
32521 /// b.insert(2);
32522 /// b.insert(3);
32545 /// a.insert(1);
32546 /// a.insert(2);
32549 /// b.insert(2);
32550 /// b.insert(3);
32598 /// a.insert(1);
32601 /// b.insert(2);
32622 /// v.insert(1);
32691 /// b.insert(4);
32693 /// b.insert(1);
32716 /// set.insert(2);
32718 /// set.insert(4);
32793 /// set.insert(0);
32794 /// set.insert(1);
32797 /// set.insert(2);
32821 /// set.insert(1);
32823 /// set.insert(2);
32847 /// set.insert(1);
32849 /// set.insert(2);
32871 /// set.insert(1);
32896 /// set.insert(1);
32917 /// [module-level documentation]: index.html#insert-and-complex-keys
32926 /// assert_eq!(set.insert(2), true);
32927 /// assert_eq!(set.insert(2), false);
32931 pub fn insert(&mut self, value: T) -> bool
32935 self.map.insert(value, ()).is_none()
32947 /// set.insert(Vec::<i32>::new());
32975 /// set.insert(2);
33045 /// a.insert(1);
33046 /// a.insert(2);
33047 /// a.insert(3);
33050 /// b.insert(3);
33051 /// b.insert(4);
33052 /// b.insert(5);
33084 /// a.insert(1);
33085 /// a.insert(2);
33086 /// a.insert(3);
33087 /// a.insert(17);
33088 /// a.insert(41);
33187 /// v.insert(1);
33206 /// v.insert(1);
33315 self.insert(elem);
33321 self.insert(elem);
33333 self.insert(elem);
34299 m.insert(1);
34300 m.insert(2);
34327 a.insert(1);
34328 a.insert(2);
34351 assert!(set_a.insert(*x))
34354 assert!(set_b.insert(*y))
34642 set.insert(a.spawn(Panic::Never));
34643 set.insert(b.spawn(Panic::InDrop));
34644 set.insert(c.spawn(Panic::Never));
34662 set.insert(a.spawn(Panic::Never));
34663 set.insert(b.spawn(Panic::InQuery));
34664 set.insert(c.spawn(Panic::InQuery));
34682 x.insert(1);
34691 x.insert(5);
34692 x.insert(12);
34693 x.insert(11);
34696 y.insert("foo");
34697 y.insert("bar");
34724 set.insert(1);
34725 set.insert(2);
34736 a.insert(1);
34747 b.insert(5);
34748 b.insert(6);
34927 a.insert(1);
34928 a.insert(2);
34929 a.insert(3);
34932 b.insert(3);
34933 b.insert(4);
34934 b.insert(5);
34953 a.insert(1);
34956 a.insert(2);
34960 a.insert(i);
35146 "failed to insert {:?}, key {:?} already exists with value {:?}",
35172 Vacant(entry) => entry.insert(default),
35195 Vacant(entry) => entry.insert(default()),
35224 entry.insert(value)
35300 Vacant(entry) => entry.insert(Default::default()),
35353 /// o.insert(37);
35358 pub fn insert(self, value: V) -> &'a mut V {
35513 /// assert_eq!(o.insert(15), 12);
35518 pub fn insert(&mut self, value: V) -> V {
35581 // Minimum number of elements to insert, to guarantee a tree with 2 levels,
35586 // Minimum number of elements to insert in ascending order, to guarantee a tree with 3 levels,
35706 map.insert(0, ());
35709 map.insert(last_key + 1, ());
35721 map.insert(last_key + 1, ());
35763 assert_eq!(map.insert(i, 10 * i), None);
35781 assert_eq!(map.insert(i, 100 * i), Some(10 * i));
35825 assert_eq!(map.insert(1, 1), None);
35837 assert_eq!(map.insert(1, 2), Some(1));
35845 assert_eq!(map.insert(2, 4), None);
36020 a.insert(1, String::from("hello"));
36021 a.insert(2, String::from("goodbye"));
36109 a.insert(1, 42);
36110 a.insert(2, 24);
36338 map.insert(Cyclic3::B, ());
36414 map.insert("aardvark".to_string(), 1);
36415 map.insert("baboon".to_string(), 2);
36416 map.insert("coyote".to_string(), 3);
36417 map.insert("dingo".to_string(), 4);
36698 map.insert(a.spawn(Panic::Never), ());
36699 map.insert(b.spawn(Panic::InDrop), ());
36700 map.insert(c.spawn(Panic::Never), ());
36718 map.insert(a.spawn(Panic::Never), ());
36719 map.insert(b.spawn(Panic::InQuery), ());
36720 map.insert(c.spawn(Panic::InQuery), ());
36744 map.insert(a.spawn(Panic::Never), ());
36745 map.insert(b.spawn(Panic::InQuery), ());
36746 map.insert(c.spawn(Panic::InQuery), ());
36775 map.insert("0".to_string(), 1);
36781 map.insert(Box::new(0), 1);
36787 map.insert(Box::new([0, 1]) as Box<[i32]>, 1);
36793 map.insert(Rc::new(0), 1);
36849 // Existing key (insert)
36854 assert_eq!(view.insert(100), 10);
36883 // Inexistent key (insert)
36887 assert_eq!(*view.insert(1000), 1000);
36898 a.insert(1, "one");
36900 b.insert(2, "two");
36901 b.insert(3, "three");
36917 assert_eq!(m.insert((), ()), None);
36920 assert_eq!(m.insert((), ()), Some(()));
36928 m.insert((), ());
36967 m.insert(Bad, Bad);
36977 map.insert(i, ());
36993 map.insert(a.spawn(Panic::Never), ());
36994 map.insert(b.spawn(Panic::InDrop), ());
36995 map.insert(c.spawn(Panic::Never), ());
37016 assert_eq!(map.insert(i, 10 * i), None);
37023 assert_eq!(map.insert(i, 100 * i), Some(10 * i));
37048 map.insert(0, 0);
37061 map.insert(a.spawn(Panic::Never), ());
37062 map.insert(b.spawn(Panic::InClone), ());
37063 map.insert(c.spawn(Panic::Never), ());
37098 map2.insert(100 * j + 1, 2 * j + 1);
37103 map1.insert(i, 10 * i);
37359 a.insert(key, value);
37383 e.insert(value);
37396 a.insert(1, 42);
37399 a.insert(2, 24);
37402 a.insert(0, 6);
37421 assert!(map.insert(pos * 2, ()).is_none());
37437 assert!(map.insert(pos * 2, ()).is_none());
37448 a.insert(i, i);
37453 b.insert(i, 2 * i);
37471 assert_eq!(a.insert($len - 1, 20), None);
37505 left.insert(a.spawn(Panic::Never), ());
37506 left.insert(b.spawn(Panic::InDrop), ()); // first duplicate key, dropped during append
37507 left.insert(c.spawn(Panic::Never), ());
37508 right.insert(b.spawn(Panic::Never), ());
37509 right.insert(c.spawn(Panic::Never), ());
37520 map1.insert(Cyclic3::A, ());
37521 map1.insert(Cyclic3::B, ());
37523 map2.insert(Cyclic3::A, ());
37524 map2.insert(Cyclic3::B, ());
37525 map2.insert(Cyclic3::C, ()); // lands first, before A
37526 map2.insert(Cyclic3::B, ()); // lands first, before C
37647 map.insert("a", a.spawn(Panic::Never));
37648 map.insert("b", b.spawn(Panic::Never));
37649 map.insert("c", c.spawn(Panic::Never));
37650 map.insert("d", d.spawn(Panic::InDrop));
37651 map.insert("e", e.spawn(Panic::Never));
37712 map.insert(i, i);
37727 map.insert(Governed(i, &gov), ());
38067 /// although insert methods allow a mutable pointer to a value to coexist.
38101 /// The methods supporting insert bend this rule by returning a raw pointer,
38735 /// Given an edge index where we want to insert into a node filled to capacity,
38776 fn insert(mut self, key: K, val: V) -> (InsertResult<'a, K, V, marker::Leaf>, *mut V) {
38833 fn insert(
38866 /// insert the split off portion into the parent node recursively, until the root is reached.
38876 let (mut split, val_ptr) = match self.insert(key, value) {
38885 Ok(parent) => match parent.insert(split.kv.0, split.kv.1, split.right) {
41918 /// vec_deque.insert(1, 'd');
41922 pub fn insert(&mut self, index: usize, value: T) {
41928 // Move the least number of elements in the ring buffer and insert
41936 // Elements are discontiguous and the insert is in the tail section
41937 // Elements are discontiguous and the insert is in the head section
41973 // contiguous, insert closer to tail:
41982 // contiguous, insert closer to tail and tail is 0:
42003 // contiguous, insert closer to head:
42018 // discontiguous, insert closer to tail, tail section:
42033 // discontiguous, insert closer to head, tail section:
42056 // discontiguous, insert is closer to tail, head section,
42077 // discontiguous, insert closer to tail, head section:
42100 // discontiguous, insert closer to head, head section:
42788 /// If you want to insert an item to a sorted `VecDeque`, while maintaining
42798 /// deque.insert(idx, num);
43584 tester.insert(to_insert, to_insert);
47134 /// [`push`] and [`insert`] will never (re)allocate if the reported capacity is
47135 /// sufficient. [`push`] and [`insert`] *will* (re)allocate if
47176 /// [`insert`]: Vec::insert
48105 /// vec.insert(1, 4);
48107 /// vec.insert(4, 5);
48111 pub fn insert(&mut self, index: usize, element: T) {
48802 /// [`extend_from_within`], [`insert`], [`append`], [`resize`] or
48809 /// [`insert`]: Vec::insert