Lines Matching defs:for

92         for ch in s.chars() {
122 for ch in s.chars().rev() {
278 for _ in 0..$iters {
401 for _ in 0..REPETITIONS {
412 for _ in 0..REPETITIONS {
423 for _ in 0..REPETITIONS {
834 for _ in 0..times {
1071 impl Drop for Droppable {
1178 for i in 0..data.len() {
1197 for item in buf.iter_mut() {
1276 // Disabling on android for the time being
1312 for _ in 0..n {
1335 for i in 0..n {
1362 for &k in &keys {
1387 for i in 0..n {
1418 for _ in 0..size {
1423 for entry in &map {
1448 for _ in 0..size {
1453 for kv in map.iter_mut() {
1477 for _ in 0..10 {
1510 for i in 0..BENCH_RANGE_SIZE {
1511 for j in i + 1..BENCH_RANGE_SIZE {
1543 for _ in 0..repeats {
1655 for i in (0..100).step_by(2) {
1726 for i in (0..10_000).step_by(2) {
1797 for i in (0..100).step_by(2) {
1835 for i in 0..(n1 + n2) {
1923 for i in (0..100).step_by(2) {
1994 for i in (0..10_000).step_by(2) {
2046 for x in &v {
2062 for x in &mut v {
2163 for i in 0..1024 {
2176 for x in &mut v {
2188 for _ in 0..100 {
2200 for _ in 0..100 {
2230 for _ in (0usize..).take_while(|x| x * x <= len) {
2241 for _ in (0usize..).take_while(|x| x * x <= len) {
2252 for _ in 0..len {
2428 for i in 0..1025 {
2441 for &i in &ring {
2454 for i in &mut ring {
2482 for x in iter {
2506 for &i in vec.iter() {
2538 for &i in vec.iter() {
2568 for _ in 0..WARMUP_N {
2576 for _ in 0..BENCH_N {
2664 for elt in 1..3 {
2667 for elt in 3..6 {
2678 for elt in 1..5 {
2681 for elt in 5..6 {
2702 for (i, elt) in m.iter().enumerate() {
2750 for (i, elt) in m.iter().rev().enumerate() {
2767 for (i, elt) in m.iter_mut().enumerate() {
2805 for (i, elt) in m.iter_mut().rev().enumerate() {
3000 for _ in iter.by_ref() {
3131 impl Drop for D {
3166 impl Drop for D {
3197 impl Drop for Elem {
3219 impl Drop for Elem {
3245 impl Drop for Elem {
3271 impl Drop for D {
3357 impl PartialEq for TestPEq {
3374 impl PartialEq for TestEq {
3397 // Exercise the base implementation for non-`TrustedLen` iterators.
3475 unsafe impl TrustedLen for Iter {}
3477 impl Iterator for Iter {
3575 for (i, ci) in string.char_indices() {
3577 for j in string[ip..].char_indices().map(|(i, _)| i).chain(Some(string.len() - ip)) {
3643 // join has fast paths for small separators up to 4 bytes
3664 impl Default for WeirdBorrow {
3670 impl Borrow<str> for WeirdBorrow {
3822 // This is not suitable for testing failure on invalid inputs.
3831 assert_eq!(&s[$range], expected, "(in assertion for: index)");
3832 assert_eq!(s.get($range), Some(expected), "(in assertion for: get)");
3837 "(in assertion for: get_unchecked)",
3845 assert_eq!(&mut s[$range], expected, "(in assertion for: index_mut)",);
3849 "(in assertion for: get_mut)",
3855 "(in assertion for: get_unchecked_mut)",
3883 // Generates test cases for bad index operations.
3885 // This generates `should_panic` test cases for Index/IndexMut
3886 // and `None` test cases for get/get_mut.
3894 // a similar input for which DATA[input] succeeds, and the corresponding
3915 assert_eq!(v.get($bad), None, "(in None assertion for get)");
3920 assert_eq!(v.get_mut($bad), None, "(in None assertion for get_mut)");
4120 // so that `get` doesn't simply return None for the wrong reason.
4256 for (i, ch) in s.char_indices() {
4259 for j in 1..ch.len_utf8() {
4382 for i in 32..64 {
4502 for (index, _) in s.char_indices() {
4548 // they are escaped. However, when the character is unescaped (e.g., for
4598 for c in it {
4614 for c in it {
4625 for c in (0..0x110000).filter_map(std::char::from_u32) {
4637 for c in (0..0x110000).filter_map(std::char::from_u32) {
4680 for b in s.bytes() {
4695 for b in s.bytes().rev() {
4740 for c in it {
4757 for c in it {
4830 // (A different predicate is needed for reverse iterator vs normal iterator.)
4999 for i in 0..s.len() {
5000 for j in i + 1..=s.len() {
5011 // prior to the fix for #16589, x.contains("abcdabcd") returned false
5012 // test all substrings for good measure
5264 for (i, e) in right.iter().enumerate() {
5467 for<'b> &'b P: Pattern<'a>,
5469 for _ in 0..3 {
5552 for ab in a.bytes() {
5631 impl<'a> IntoCow<'a, str> for String {
5637 impl<'a> IntoCow<'a, str> for &'a str {
5771 for p in &pairs {
6213 impl RangeBounds<usize> for EvilRange {
6236 impl RangeBounds<usize> for EvilRange {
6280 for _i in 0..16 {
6310 // on 64-bit, we assume the OS will give an OOM for such a ridiculous size.
6311 // Any platform that succeeds for these requests is technically broken with
6389 // See that test for comments.
6546 impl Drop for DropCounter<'_> {
6590 for i in 0..16 {
6654 for i in 0..3 {
6661 for i in 3..10 {
6731 for p in slice {
6745 for p in slice {
6762 for p in left {
6770 for p in right {
6856 impl Drop for Wrap {
6963 for &() in &v {}
6971 for &mut () in &mut v {}
7024 impl Drop for Elem {
7044 impl Drop for BadElem {
7116 for i in vec {
7126 for i in vec.into_iter().rev() {
7136 for i in vec {
7146 for i in vec.drain(..) {
7157 for i in vec.drain(..) {
7168 for i in vec.drain(..).rev() {
7179 for i in vec.drain(..) {
7196 for _ in v.drain(4..) {}
7200 for _ in v.drain(1..4) {}
7204 for _ in v.drain(1..4).rev() {}
7208 for _ in v.drain(1..4).rev() {}
7215 for _ in v.drain(1..=3) {}
7219 for _ in v.drain(1..=5) {}
7223 for _ in v.drain(0..=5) {}
7227 for _ in v.drain(0..=3) {}
7231 for _ in v.drain(..=0) {}
7241 for _ in v.drain(usize::MAX - 1..) {}
7248 for _ in v.drain(usize::MAX - 1..=usize::MAX - 1) {}
7290 impl Drop for D {
7482 impl Drop for D {
7592 impl Drop for Droppable {
7676 for i in 0..0x1000 {
7733 for _ in iter.by_ref() {
7850 impl Drop for Check {
7885 for (index, count) in drop_counts.iter().cloned().enumerate() {
7902 impl Drop for Check {
7936 for (index, count) in drop_counts.iter().cloned().enumerate() {
7959 for i in 0..16 {
7989 // on 64-bit, we assume the OS will give an OOM for such a ridiculous size.
7990 // Any platform that succeeds for these requests is technically broken with
8096 // See that test for comments.
8281 // unsafe impl<T: ?Sized> IsZero for *mut T {
8288 // … to call `RawVec::with_capacity_zeroed` for creating `Vec<*mut T>`,
8289 // which is incorrect for fat pointers since `<*mut T>::is_null` only looks at the data component.
8302 // Polyfill for https://github.com/rust-lang/rfcs/pull/2580
8328 for _ in 0..8 {
8333 for _ in 8..16 {
8338 for _ in 16..32 {
8343 for _ in 32..64 {
8356 for _ in 0..4 {
8363 for _ in 4..8 {
8370 for _ in 8..16 {
8377 for _ in 16..32 {
8384 for _ in 32..64 {
8397 for _ in 0..1 {
8402 for _ in 1..2 {
8407 for _ in 2..4 {
8412 for _ in 4..8 {
8417 for _ in 8..16 {
8422 for _ in 16..32 {
8427 for _ in 32..64 {
8571 for len in 0..N {
8575 for _ in 0..len {
8614 impl Clone for CopyOnly {
8720 impl PartialEq for Foo {
8737 for x in 0u8..255u8 {
8761 impl PartialEq for Panic {
8767 impl Drop for Panic {
8805 // Regression test for issue #82533
8813 impl Clone for Panic<'_> {
8823 impl Drop for Panic<'_> {
8838 // 4 times (3 for items already in vector, 1 for just appended).
9114 impl PartialEq for TestPEq {
9131 impl PartialEq for TestEq {
9150 // Exercise the base implementation for non-`TrustedLen` iterators.
9228 unsafe impl TrustedLen for Iter {}
9230 impl Iterator for Iter {
9641 for len in (2..25).chain(500..510) {
9642 for &modulus in &[5, 10, 100, 1000] {
9643 for _ in 0..10 {
9674 for _ in 0..5 {
9692 for i in 0..v.len() {
9697 for i in 0..v.len() {
9717 for len in (2..25).chain(large_range) {
9718 for _ in 0..rounds {
10026 for i in 0..xs.len() {
10027 for j in i..xs.len() {
10036 for x in &mut xs {
10047 for &x in xs.iter().rev() {
10057 for (i, x) in xs.iter_mut().rev().enumerate() {
10431 for p in left {
10439 for p in right {
10456 for f in &v {
10462 for f in &v[1..3] {
10468 for f in &mut v {
10474 for f in v {
10482 for f in &xs {
10492 for i in 4..100 {
10533 for slice in xs.split_mut(|x| *x == 0) {
10539 for slice in xs.split_mut(|x| *x == 0).take(5) {
10548 for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
10568 for (i, chunk) in v.chunks_mut(3).enumerate() {
10569 for x in chunk {
10580 for (i, chunk) in v.chunks_mut(3).rev().enumerate() {
10581 for x in chunk {
10600 for (i, chunk) in v.chunks_exact_mut(3).enumerate() {
10601 for x in chunk {
10612 for (i, chunk) in v.chunks_exact_mut(3).rev().enumerate() {
10613 for x in chunk {
10632 for (i, chunk) in v.rchunks_mut(3).enumerate() {
10633 for x in chunk {
10644 for (i, chunk) in v.rchunks_mut(3).rev().enumerate() {
10645 for x in chunk {
10664 for (i, chunk) in v.rchunks_exact_mut(3).enumerate() {
10665 for x in chunk {
10676 for (i, chunk) in v.rchunks_exact_mut(3).rev().enumerate() {
10677 for x in chunk {
10738 impl Drop for Canary {
10744 impl Clone for Canary {
10891 impl PartialEq for DropCounter {
10897 impl PartialOrd for DropCounter {
10906 impl Ord for DropCounter {
10912 impl Drop for DropCounter {
10932 for panic_countdown in 0..count {
10935 for i in 0..len {
10955 for (i, c) in DROP_COUNTS.iter().enumerate().take(len) {
10957 assert!(count == 1, "found drop count == {} for i == {}, len == {}", count, i, len);
10984 for len in lens {
10985 for &modulus in moduli {
10986 for &has_runs in &[false, true] {
10996 for c in &mut input {
11000 for _ in 0..5 {
11285 for i in 0..66 {
11290 for i in 0..66 {
11295 for i in 0..66 {
11299 for i in 0..66 {
11307 for i in 1..4 {
11317 for i in 1..4 {
11416 // the 'B' scenario for growth
11468 for i in 0..5 {
11476 for i in 6..9 {
11502 for i in 0..5 {
11510 for i in 6..9 {
11536 for i in 0..3 {
11540 for (i, elt) in d.iter_mut().enumerate() {
11559 for i in 0..3 {
11563 for (i, elt) in d.iter_mut().rev().enumerate() {
11592 for i in 0..5 {
11603 for i in 0..5 {
11606 for i in 6..9 {
11617 for i in 0..5 {
11620 for i in 6..9 {
11655 for i in 0..5 {
11666 for i in 0..5 {
11669 for i in 6..9 {
11680 for i in 0..5 {
11683 for i in 6..9 {
11710 for (i, &x) in deq.iter().enumerate() {
11797 for _ in 0..ring.capacity() {
11800 for elt in &mut ring {
11816 for _ in 0..10 {
11819 for elt in &mut ring {
11826 for _ in 0..shifted.capacity() {
11828 for elt in &mut shifted {
11863 impl Drop for Elem {
11885 impl Drop for Elem {
11911 impl Drop for Elem {
11937 impl Drop for D {
11969 for i in 0..3 {
11973 for i in 0..3 {
11980 for i in 0..1 {
11984 for i in 0..3 {
11988 for i in 0..3 {
11995 for i in 0..3 {
11999 for i in 0..3 {
12003 for i in 0..3 {
12043 for i in 0..3 {
12081 for i in 0..first {
12090 for j in -last..0 {
12109 for i in 0..first {
12118 for j in -last..0 {
12161 for a in 0..push_back {
12164 for b in 0..push_front {
12167 for _ in 0..pop_back {
12170 for _ in 0..pop_front {
12182 for src_push_back in 0..max {
12183 for src_push_front in 0..max {
12185 for src_pop_back in 0..(src_push_back + src_push_front) {
12186 for src_pop_front in 0..(src_push_back + src_push_front - src_pop_back) {
12194 for dst_push_back in 0..max {
12195 for dst_push_front in 0..max {
12196 for dst_pop_back in 0..(dst_push_back + dst_push_front) {
12197 for dst_pop_front in
12232 impl Drop for DropCounter<'_> {
12338 for i in 0..16 {
12368 // on 64-bit, we assume the OS will give an OOM for such a ridiculous size.
12369 // Any platform that succeeds for these requests is technically broken with
12472 // See that test for comments.
12669 for shift in shifts.iter().cloned() {
12672 for i in 0..n {
12687 for shift in shifts.iter().cloned() {
12690 for i in 0..n {
12730 for n in 0..10 {
12777 for n in 0..10 {
12801 impl Drop for D {
12835 impl Drop for D {
12931 // Test that for all possible sequences of push_front / push_back,
12934 for len in 0..N {
12938 for case in 0..(1 << len) {
12940 for bit in 0..len {
12976 impl fmt::LowerHex for A {
12981 impl fmt::UpperHex for B {
12986 impl fmt::Display for C {
12991 impl fmt::Binary for D {
13295 for el in &heap {
13367 for i in 0..it.len() {
13390 for i in 0..len {
13551 for &x in &xs {
13581 impl Drop for D {
13710 impl<T> Drop for PanicOrd<T> {
13717 impl<T: PartialOrd> PartialOrd for PanicOrd<T> {
13734 for _ in 0..ntest {
13735 for i in 1..=DATASZ {
13799 for size in (0..8).map(|i| 2usize.pow(i)) {
13816 for size in (0..8).map(|i| 2usize.pow(i)) {
13845 for &align in &[4, 8, 16, 32] {
13847 for &size in &[align / 2, align - 1] {
13856 for &ptr in &pointers {
13865 for &ptr in &pointers {
13930 // required for this macro definition, is not available. Instead use the
13932 // NB see the slice::hack module in slice.rs for more information
13954 /// are used; see [`std::fmt`] for more information.
13956 /// A common use for `format!` is concatenation and interpolation of strings.
13973 /// since `fmt::Write for String` never returns an error itself.
14195 // `realloc` probably checks for `new_size >= old_layout.size()` or something similar.
14207 // both the old and new memory allocation are valid for reads and writes for `old_size`
14210 // for `dealloc` must be upheld by the caller.
14223 unsafe impl Allocator for Global {
14286 // `realloc` probably checks for `new_size <= old_layout.size()` or something similar.
14295 // both the old and new memory allocation are valid for reads and writes for `new_size`
14298 // for `dealloc` must be upheld by the caller.
14309 /// The allocator for unique pointers.
14407 impl<T: Clone> WriteCloneIntoRaw for T {
14416 impl<T: Copy> WriteCloneIntoRaw for T {
14448 /// A low-level utility for more ergonomically allocating, reallocating, and deallocating
14450 /// involved. This type is excellent for building your own data structures like Vec and VecDeque.
14459 /// * Calls `handle_alloc_error` for fallible allocations.
14488 /// `RawVec` with capacity `usize::MAX`. Useful for implementing
14495 /// capacity and alignment requirements for a `[T; capacity]`. This is
14523 /// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
14537 // - 1 otherwise, to avoid wasting too much space for very short Vecs.
14546 /// Like `new`, but parameterized over the choice of allocator for
14555 /// allocator for the returned `RawVec`.
14562 /// of allocator for the returned `RawVec`.
14579 /// that may have been performed. (See description of type for details.)
14639 /// The `capacity` cannot exceed `isize::MAX` for sized types. (only a concern on 32-bit
14694 /// This is ideal for implementing a bulk-push operation like `extend`.
14721 /// for x in elems {
14767 /// is free to give back more than we asked for.
14896 // above `RawVec::grow_amortized` for details. (The `A` parameter isn't
14908 // Check for the error here to minimize the size of `RawVec::grow_*`.
14916 // The allocator checks for alignment equality
14927 unsafe impl<#[may_dangle] T, A: Allocator> Drop for RawVec<T, A> {
14936 // Central function for reserve error handling.
14950 // On 64-bit we just need to check for overflow since trying to allocate
14952 // an extra guard for this in case we're running on a platform which can use
14964 // One central function responsible for reporting capacity overflows. This'll
14987 //! is guaranteed to be valid for the duration of the entire program.
15047 impl<S: Borrow<str>> Concat<str> for [S] {
15056 impl<S: Borrow<str>> Join<&str> for [S] {
15074 for s in iter {
15083 for s in iter {
15103 // Optimized join implementation that works for both Vec<T> (T: Copy) and String's inner vec
15105 // For this reason SliceConcat<T> is not specialized for T: Copy and SliceConcat<str> is the
15106 // only user of this function. It is left in place for the time when that is fixed.
15108 // the bounds for String-join are S: Borrow<str> and for Vec-join Borrow<[T]>
15109 // [T] and str both impl AsRef<[T]> for some T
15129 // the entire Vec pre-allocated for safety
15148 // generate loops with hardcoded offsets for small separators
15153 // slices for the length calculation and the actual copy.
15162 impl Borrow<str> for String {
15170 impl BorrowMut<str> for String {
15178 impl ToOwned for str {
15192 /// Methods for string slices.
15243 for (start, part) in self.match_indices(from) {
15282 for (start, part) in self.match_indices(pat).take(count) {
15333 for (i, c) in self[..].char_indices() {
15360 // for the definition of `Final_Sigma`.
15412 for c in self[..].chars() {
15572 impl Drop for Canary {
15955 for _i in 0..count {
16003 impl Clone for Fail {
16174 //! This module contains the [`String`] type, the [`ToString`] trait for
16316 /// [`&str`]s as arguments unless they need a `String` for some specific
16329 /// impl<'a> TraitExample for &'a str {}
16377 /// // unsafe because we are responsible for making sure the components are
16396 /// for _ in 0..5 {
16422 /// for _ in 0..5 {
16456 /// This type is the error type for the [`from_utf8`] method on [`String`]. It
16496 /// This type is the error type for the [`from_utf16`] method on [`String`].
16563 /// // The String contains no chars, even though it has capacity for more
16568 /// for _ in 0..10 {
16586 // required for this method definition, is not available. Since we don't
16587 // require this method for testing purposes, I'll just stub it
16588 // NB see the slice::hack module in slice.rs for more information
16608 /// This method will take care to not copy the vector, for efficiency's
16644 /// See the docs for [`FromUtf8Error`] for more details on what you can do
16732 for lossy::Utf8LossyChunk { valid, broken } in iter {
16763 // This isn't done via collect::<Result<_, _>>() for performance reasons.
16766 for c in decode_utf16(v.iter().cloned()) {
16813 /// After calling this function, the caller is responsible for the
16891 /// See the safe version, [`from_utf8`], for more details.
17112 /// Tries to reserve capacity for at least `additional` more elements to be inserted
17147 /// Tries to reserve the minimum capacity for exactly `additional` more elements to
17399 P: for<'x> Pattern<'x>,
17420 for (start, end) in matches {
17448 /// The exact order may be useful for tracking external state, like an index.
17469 impl<'a> Drop for SetLenOnDrop<'a> {
17883 /// an analogue to `FromUtf8Error`. See its documentation for more details
17909 impl fmt::Display for FromUtf8Error {
17916 impl fmt::Display for FromUtf16Error {
17923 impl Clone for String {
17934 impl FromIterator<char> for String {
17943 impl<'a> FromIterator<&'a char> for String {
17952 impl<'a> FromIterator<&'a str> for String {
17961 impl FromIterator<String> for String {
17979 impl FromIterator<Box<str>> for String {
17988 impl<'a> FromIterator<Cow<'a, str>> for String {
18007 impl Extend<char> for String {
18027 impl<'a> Extend<&'a char> for String {
18044 impl<'a> Extend<&'a str> for String {
18056 impl Extend<Box<str>> for String {
18063 impl Extend<String> for String {
18075 impl<'a> Extend<Cow<'a, str>> for String {
18086 /// A convenience impl that delegates to the impl for `&str`.
18098 impl<'a, 'b> Pattern<'a> for &'b String {
18132 impl PartialEq for String {
18147 impl<'a, 'b> PartialEq<$rhs> for $lhs {
18160 impl<'a, 'b> PartialEq<$lhs> for $rhs {
18180 impl Default for String {
18189 impl fmt::Display for String {
18197 impl fmt::Debug for String {
18205 impl hash::Hash for String {
18212 /// Implements the `+` operator for concatenating two strings.
18250 impl Add<&str> for String {
18260 /// Implements the `+=` operator for appending to a `String`.
18264 impl AddAssign<&str> for String {
18272 impl ops::Index<ops::Range<usize>> for String {
18281 impl ops::Index<ops::RangeTo<usize>> for String {
18290 impl ops::Index<ops::RangeFrom<usize>> for String {
18299 impl ops::Index<ops::RangeFull> for String {
18308 impl ops::Index<ops::RangeInclusive<usize>> for String {
18317 impl ops::Index<ops::RangeToInclusive<usize>> for String {
18327 impl ops::IndexMut<ops::Range<usize>> for String {
18334 impl ops::IndexMut<ops::RangeTo<usize>> for String {
18341 impl ops::IndexMut<ops::RangeFrom<usize>> for String {
18348 impl ops::IndexMut<ops::RangeFull> for String {
18355 impl ops::IndexMut<ops::RangeInclusive<usize>> for String {
18362 impl ops::IndexMut<ops::RangeToInclusive<usize>> for String {
18370 impl ops::Deref for String {
18380 impl ops::DerefMut for String {
18387 /// A type alias for [`Infallible`].
18389 /// This alias exists for backwards compatibility, and may be eventually deprecated.
18396 impl FromStr for String {
18404 /// A trait for converting a value to a `String`.
18406 /// This trait is automatically implemented for any type which implements the
18409 /// implementation for free.
18437 /// since `fmt::Write for String` never returns an error itself.
18439 impl<T: fmt::Display + ?Sized> ToString for T {
18455 impl ToString for char {
18463 impl ToString for str {
18471 impl ToString for Cow<'_, str> {
18479 impl ToString for String {
18487 impl AsRef<str> for String {
18495 impl AsMut<str> for String {
18503 impl AsRef<[u8]> for String {
18511 impl From<&str> for String {
18519 impl From<&mut str> for String {
18530 impl From<&String> for String {
18540 impl From<Box<str>> for String {
18561 impl From<String> for Box<str> {
18581 impl<'a> From<Cow<'a, str>> for String {
18588 impl<'a> From<&'a str> for Cow<'a, str> {
18606 impl<'a> From<String> for Cow<'a, str> {
18626 impl<'a> From<&'a String> for Cow<'a, str> {
18645 impl<'a> FromIterator<char> for Cow<'a, str> {
18652 impl<'a, 'b> FromIterator<&'b str> for Cow<'a, str> {
18659 impl<'a> FromIterator<String> for Cow<'a, str> {
18666 impl From<String> for Vec<u8> {
18677 /// for b in v1 {
18687 impl fmt::Write for String {
18701 /// A draining iterator for `String`.
18704 /// documentation for more.
18720 impl fmt::Debug for Drain<'_> {
18727 unsafe impl Sync for Drain<'_> {}
18729 unsafe impl Send for Drain<'_> {}
18732 impl Drop for Drain<'_> {
18766 // impl<'a> AsRef<str> for Drain<'a> {
18773 // impl<'a> AsRef<[u8]> for Drain<'a> {
18780 impl Iterator for Drain<'_> {
18799 impl DoubleEndedIterator for Drain<'_> {
18807 impl FusedIterator for Drain<'_> {}
18810 impl From<char> for String {
18816 //! A module for working with borrowed data.
18833 impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
18846 /// implementing the `Clone` trait. But `Clone` works only for going from `&T`
18896 impl<T> ToOwned for T
18933 /// for i in 0..input.len() {
19006 impl<B: ?Sized + ToOwned> Clone for Cow<'_, B> {
19144 impl<B: ?Sized + ToOwned> Deref for Cow<'_, B> {
19156 impl<B: ?Sized> Eq for Cow<'_, B> where B: Eq + ToOwned {}
19159 impl<B: ?Sized> Ord for Cow<'_, B>
19170 impl<'a, 'b, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, C>> for Cow<'a, B>
19182 impl<'a, B: ?Sized> PartialOrd for Cow<'a, B>
19193 impl<B: ?Sized> fmt::Debug for Cow<'_, B>
19206 impl<B: ?Sized> fmt::Display for Cow<'_, B>
19219 impl<B: ?Sized> Default for Cow<'_, B>
19223 /// Creates an owned Cow<'a, B> with the default value for the contained owned value.
19230 impl<B: ?Sized> Hash for Cow<'_, B>
19241 impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T> {
19248 impl<'a> Add<&'a str> for Cow<'a, str> {
19259 impl<'a> Add<Cow<'a, str>> for Cow<'a, str> {
19270 impl<'a> AddAssign<&'a str> for Cow<'a, str> {
19286 impl<'a> AddAssign<Cow<'a, str>> for Cow<'a, str> {
19302 //! This library provides smart pointers and collections for managing
19323 //! for sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and
19327 //! constraining for an application, and is often paired with the [`Cell`] or
19337 //! This type allows for shared access to the contained data, and is often
19406 // blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad
19407 // that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs
19408 // from other crates, but since this can only appear for lang items, it doesn't seem worth fixing.
19459 // Heaps provided for low-level allocation strategies
19496 //! Single-threaded reference-counting pointers. 'Rc' stands for 'Reference
19523 //! (the backing store for the inner value) alive.
19562 //! is done using the `Clone` trait implemented for [`Rc<T>`][`Rc`] and [`Weak<T>`][`Weak`].
19706 //! for gadget_weak in gadget_owner.gadgets.borrow().iter() {
19714 //! // need graceful error handling for a `None` result.
19736 //! [fully qualified syntax]: https://doc.rust-lang.org/book/ch19-03-advanced-traits.html#fully-qualified-syntax-for-disambiguation-calling-methods-with-the-same-name
19781 /// A single-threaded reference-counting pointer. 'Rc' stands for 'Reference
19784 /// See the [module-level documentation](./index.html) for more details.
19799 impl<T: ?Sized> !marker::Send for Rc<T> {}
19801 impl<T: ?Sized> !marker::Sync for Rc<T> {}
19804 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Rc<U>> for Rc<T> {}
19807 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Rc<U>> for Rc<T> {}
19850 /// stored for use at a later time.
19889 // weak pointer for ourselves, but this would result in additional
19906 // so don't run the destructor for our old weak reference.
19946 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and
20034 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and
20143 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and
20282 /// for as long there are strong counts in the `Rc`.
20312 /// [`mem::transmute`][transmute] for more information on what
20415 /// least 1) for the duration of this method.
20522 /// for the duration of the returned borrow.
20524 /// for example immediately after `Rc::new`.
20641 // Weak here -- we know other Weaks can clean up for us)
20688 /// Allocates an `RcBox<T>` with sufficient space for
20692 /// and must return back a (potentially fat)-pointer for the `RcBox<T>`.
20709 /// Allocates an `RcBox<T>` with sufficient space for
20714 /// and must return back a (potentially fat)-pointer for the `RcBox<T>`.
20727 // Allocate for the layout.
20742 /// Allocates an `RcBox<T>` with sufficient space for an unsized inner value
20744 // Allocate for the `RcBox<T>` using the given value.
20814 impl<T> Drop for Guard<T> {
20836 for (i, item) in iter.enumerate() {
20849 /// Specialization trait used for `From<&[T]>`.
20854 impl<T: Clone> RcFromSlice<T> for Rc<[T]> {
20861 impl<T: Copy> RcFromSlice<T> for Rc<[T]> {
20869 impl<T: ?Sized> Deref for Rc<T> {
20879 impl<T: ?Sized> Receiver for Rc<T> {}
20882 unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc<T> {
20896 /// impl Drop for Foo {
20928 impl<T: ?Sized> Clone for Rc<T> {
20951 impl<T: Default> Default for Rc<T> {
20952 /// Creates a new `Rc<T>`, with the `Default` value for `T`.
20975 impl<T: ?Sized + PartialEq> RcEqIdent<T> for Rc<T> {
20991 impl<T: Eq> MarkerEq for T {}
20995 /// store large values, that are slow to clone, but also heavy to check for equality, causing this
21001 impl<T: ?Sized + MarkerEq> RcEqIdent<T> for Rc<T> {
21014 impl<T: ?Sized + PartialEq> PartialEq for Rc<T> {
21015 /// Equality for two `Rc`s.
21038 /// Inequality for two `Rc`s.
21062 impl<T: ?Sized + Eq> Eq for Rc<T> {}
21065 impl<T: ?Sized + PartialOrd> PartialOrd for Rc<T> {
21066 /// Partial comparison for two `Rc`s.
21085 /// Less-than comparison for two `Rc`s.
21103 /// 'Less than or equal to' comparison for two `Rc`s.
21121 /// Greater-than comparison for two `Rc`s.
21139 /// 'Greater than or equal to' comparison for two `Rc`s.
21159 impl<T: ?Sized + Ord> Ord for Rc<T> {
21160 /// Comparison for two `Rc`s.
21181 impl<T: ?Sized + Hash> Hash for Rc<T> {
21188 impl<T: ?Sized + fmt::Display> fmt::Display for Rc<T> {
21195 impl<T: ?Sized + fmt::Debug> fmt::Debug for Rc<T> {
21202 impl<T: ?Sized> fmt::Pointer for Rc<T> {
21209 impl<T> From<T> for Rc<T> {
21216 impl<T: Clone> From<&[T]> for Rc<[T]> {
21234 impl From<&str> for Rc<str> {
21252 impl From<String> for Rc<str> {
21270 impl<T: ?Sized> From<Box<T>> for Rc<T> {
21288 impl<T> From<Vec<T>> for Rc<[T]> {
21313 impl<'a, B> From<Cow<'a, B>> for Rc<B>
21328 impl<T, const N: usize> TryFrom<Rc<[T]>> for Rc<[T; N]> {
21341 impl<T> iter::FromIterator<T> for Rc<[T]> {
21363 /// .into(); // A second allocation for `Rc<[T]>` happens here.
21367 /// This will allocate as many times as needed for constructing the `Vec<T>`
21368 /// and then it will allocate once for turning the `Vec<T>` into the `Rc<[T]>`.
21373 /// a single allocation will be made for the `Rc<[T]>`. For example:
21385 /// Specialization trait used for collecting into `Rc<[T]>`.
21390 impl<T, I: Iterator<Item = T>> ToRcSlice<T> for I {
21396 impl<T, I: iter::TrustedLen<Item = T>> ToRcSlice<T> for I {
21398 // This is the case for a `TrustedLen` iterator.
21432 /// A `Weak` pointer is useful for keeping a temporary reference to the allocation
21454 impl<T: ?Sized> !marker::Send for Weak<T> {}
21456 impl<T: ?Sized> !marker::Sync for Weak<T> {}
21459 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Weak<U>> for Weak<T> {}
21462 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Weak<U>> for Weak<T> {}
21585 /// It is allowed for the strong count to be 0 at the time of calling this. Nevertheless, this
21616 // See Weak::as_ptr for context on how the input pointer is derived.
21700 // the field may be mutated concurrently (for example, if the last `Rc`
21758 impl<T: ?Sized> Drop for Weak<T> {
21768 /// impl Drop for Foo {
21798 impl<T: ?Sized> Clone for Weak<T> {
21820 impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
21827 impl<T> Default for Weak<T> {
21910 impl<T: ?Sized> RcInnerPtr for RcBox<T> {
21922 impl<'a> RcInnerPtr for WeakInner<'a> {
21935 impl<T: ?Sized> borrow::Borrow<T> for Rc<T> {
21942 impl<T: ?Sized> AsRef<T> for Rc<T> {
21949 impl<T: ?Sized> Unpin for Rc<T> {}
21951 /// Get the offset within an `RcBox` for the payload behind a pointer.
21955 /// The pointer must point to (and have valid metadata for) a previously
22002 //! There are several structs that are useful for slices, such as [`Iter`], which
22007 //! There are several implementations of common traits for slices. Some examples
22011 //! * [`Eq`], [`Ord`] - for slices whose element type are [`Eq`] or [`Ord`].
22012 //! * [`Hash`] - for slices whose element type is [`Hash`].
22021 //! for n in numbers {
22030 //! for score in &mut scores[..] {
22101 // HACK(japaric) needed for the implementation of `vec!` macro during testing
22102 // N.B., see the `hack` module in this file for more details.
22106 // HACK(japaric) needed for the implementation of `Vec::clone` during testing
22107 // N.B., see the `hack` module in this file for more details.
22113 // `core::slice::SliceExt` - we need to supply these functions for the
22122 // `vec!` macro mostly and causes perf regression. See #71204 for
22143 impl<T: Clone> ConvertVec for T {
22150 impl<'a, T, A: Allocator> Drop for DropGuard<'a, T, A> {
22163 // .take(slots.len()) is necessary for LLVM to remove bounds checks
22165 for (i, b) in s.iter().enumerate().take(slots.len()) {
22179 impl<T: Copy> ConvertVec for T {
22213 /// Also, it allocates temporary storage half the size of `self`, but for short slices a
22237 /// The comparator function must define a total ordering for the elements in the slice. If
22239 /// total order if it is (for all `a`, `b` and `c`):
22242 /// * transitive, `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.
22264 /// Also, it allocates temporary storage half the size of `self`, but for short slices a
22307 /// Also, it allocates temporary storage half the size of `self`, but for short slices a
22367 // Helper macro for indexing our vector by the smallest possible type, to reduce allocation.
22376 for i in 0..$slice.len() {
22446 // N.B., see the `hack` module in this file for more details.
22467 // N.B., see the `hack` module in this file for more details.
22643 // Extension traits for slices over specific kinds of data
22646 /// Helper trait for [`[T]::concat`](slice::concat).
22656 /// 608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
22667 /// impl std::borrow::Borrow<[u32]> for Foo {
22671 /// impl std::borrow::Borrow<[String]> for Foo {
22686 /// Helper trait for [`[T]::join`](slice::join)
22699 impl<T: Clone, V: Borrow<[T]>> Concat<T> for [V] {
22705 for v in slice {
22713 impl<T: Clone, V: Borrow<[T]>> Join<&T> for [V] {
22726 for v in iter {
22735 impl<T: Clone, V: Borrow<[T]>> Join<&[T]> for [V] {
22749 for v in iter {
22758 // Standard trait implementations for slices
22762 impl<T> Borrow<[T]> for Vec<T> {
22769 impl<T> BorrowMut<[T]> for Vec<T> {
22776 impl<T: Clone> ToOwned for [T] {
22821 // 2. Iterate until the right place for the first element is found. Then shift the
22822 // elements succeeding it to make room for it and finally place it into the
22826 // for it is found. As we go along, copy every traversed element into the slot
22847 for i in 2..v.len() {
22864 impl<T> Drop for InsertionHole<T> {
22977 impl<T> Drop for MergeHole<T> {
22996 /// 1. for every `i` in `1..runs.len()`: `runs[i - 1].len > runs[i].len`
22997 /// 2. for every `i` in `2..runs.len()`: `runs[i - 2].len > runs[i - 1].len + runs[i].len`
23019 for i in (0..len - 1).rev() {
23093 // TimSort is infamous for its buggy implementations, as described here:
23098 // hold for *all* runs in the stack.
23100 // This function correctly checks invariants for the top four runs. Additionally, if the top
23125 //! Types and Traits for working with asynchronous tasks.
23140 /// those for embedded systems) cannot use this API, which is why [`RawWaker`]
23141 /// exists as an alternative for those systems.
23150 /// **Note:** This example trades correctness for simplicity. In order to prevent
23163 /// impl Wake for ThreadWaker {
23212 impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
23215 /// No heap allocations or atomic operations are used for this conversion.
23224 impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for RawWaker {
23227 /// No heap allocations or atomic operations are used for this conversion.
23233 // NB: This private function for constructing a RawWaker is used, rather than
23234 // inlining this into the `From<Arc<W>> for RawWaker` impl, to ensure that
23235 // the safety of `From<Arc<W>> for Waker` does not depend on the correct
23275 //! See the [`Arc<T>`][Arc] documentation for more details.
23321 // reports in Arc / Weak implementation use atomic loads for synchronization
23330 /// A thread-safe reference-counting pointer. 'Arc' stands for 'Atomically
23348 /// Unlike [`Rc<T>`], `Arc<T>` uses atomic operations for its reference
23352 /// [`Rc<T>`] for lower overhead. [`Rc<T>`] is a safe default, because the
23378 /// (the backing store for the value) alive.
23388 /// `Clone` trait implemented for [`Arc<T>`][Arc] and [`Weak<T>`][Weak].
23443 /// [fully qualified syntax]: https://doc.rust-lang.org/book/ch19-03-advanced-traits.html#fully-qualified-syntax-for-disambiguation-calling-methods-with-the-same-name
23459 /// for _ in 0..10 {
23479 /// for _ in 0..10 {
23489 /// See the [`rc` documentation][rc_examples] for more examples of reference
23501 unsafe impl<T: ?Sized + Sync + Send> Send for Arc<T> {}
23503 unsafe impl<T: ?Sized + Sync + Send> Sync for Arc<T> {}
23506 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
23509 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Arc<U>> for Arc<T> {}
23531 /// A `Weak` pointer is useful for keeping a temporary reference to the allocation
23553 unsafe impl<T: ?Sized + Sync + Send> Send for Weak<T> {}
23555 unsafe impl<T: ?Sized + Sync + Send> Sync for Weak<T> {}
23558 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Weak<U>> for Weak<T> {}
23560 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Weak<U>> for Weak<T> {}
23563 impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> {
23576 // the value usize::MAX acts as a sentinel for temporarily "locking" the
23584 unsafe impl<T: ?Sized + Sync + Send> Send for ArcInner<T> {}
23585 unsafe impl<T: ?Sized + Sync + Send> Sync for ArcInner<T> {}
23601 // held by all the strong pointers (kinda), see std/rc.rs for more info
23613 /// stored for use at a later time.
23648 // weak pointer for ourselves, but this would result in additional
23678 // so don't run the destructor for our old weak reference.
23718 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
23768 // held by all the strong pointers (kinda), see std/rc.rs for more info
23815 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
23916 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and
24052 /// The counts are not affected in any way and the `Arc` is not consumed. The pointer is valid for
24083 /// [`mem::transmute`][transmute] for more information on what
24230 /// least 1) for the duration of this method.
24340 /// Allocates an `ArcInner<T>` with sufficient space for
24344 /// and must return back a (potentially fat)-pointer for the `ArcInner<T>`.
24361 /// Allocates an `ArcInner<T>` with sufficient space for
24366 /// and must return back a (potentially fat)-pointer for the `ArcInner<T>`.
24392 /// Allocates an `ArcInner<T>` with sufficient space for an unsized inner value.
24394 // Allocate for the `ArcInner<T>` using the given value.
24466 impl<T> Drop for Guard<T> {
24488 for (i, item) in iter.enumerate() {
24501 /// Specialization trait used for `From<&[T]>`.
24506 impl<T: Clone> ArcFromSlice<T> for Arc<[T]> {
24513 impl<T: Copy> ArcFromSlice<T> for Arc<[T]> {
24521 impl<T: ?Sized> Clone for Arc<T> {
24569 impl<T: ?Sized> Deref for Arc<T> {
24579 impl<T: ?Sized> Receiver for Arc<T> {}
24643 // Note that it is not possible for the read of `weak` to yield
24720 /// for the duration of the returned borrow.
24722 /// for example immediately after `Arc::new`.
24775 unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc<T> {
24789 /// impl Drop for Foo {
24997 /// It is allowed for the strong count to be 0 at the time of calling this. Nevertheless, this
25028 // See Weak::as_ptr for context on how the input pointer is derived.
25089 // See comments in `Arc::clone` for why we do this (for `mem::forget`).
25094 // Relaxed is fine for the failure case because we don't have any expectations about the new state.
25095 // Acquire is necessary for the success case to synchronise with `Arc::new_cyclic`, when the inner
25152 // the field may be mutated concurrently (for example, if the last `Arc`
25210 impl<T: ?Sized> Clone for Weak<T> {
25229 // See comments in Arc::clone() for why this is relaxed. This can use a
25235 // See comments in Arc::clone() for why we do this (for mem::forget).
25245 impl<T> Default for Weak<T> {
25266 impl<T: ?Sized> Drop for Weak<T> {
25276 /// impl Drop for Foo {
25296 // It's not necessary to check for the locked state here, because the
25316 impl<T: ?Sized + PartialEq> ArcEqIdent<T> for Arc<T> {
25329 /// store large values, that are slow to clone, but also heavy to check for equality, causing this
25335 impl<T: ?Sized + crate::rc::MarkerEq> ArcEqIdent<T> for Arc<T> {
25348 impl<T: ?Sized + PartialEq> PartialEq for Arc<T> {
25349 /// Equality for two `Arc`s.
25371 /// Inequality for two `Arc`s.
25394 impl<T: ?Sized + PartialOrd> PartialOrd for Arc<T> {
25395 /// Partial comparison for two `Arc`s.
25413 /// Less-than comparison for two `Arc`s.
25430 /// 'Less than or equal to' comparison for two `Arc`s.
25447 /// Greater-than comparison for two `Arc`s.
25464 /// 'Greater than or equal to' comparison for two `Arc`s.
25482 impl<T: ?Sized + Ord> Ord for Arc<T> {
25483 /// Comparison for two `Arc`s.
25502 impl<T: ?Sized + Eq> Eq for Arc<T> {}
25505 impl<T: ?Sized + fmt::Display> fmt::Display for Arc<T> {
25512 impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
25519 impl<T: ?Sized> fmt::Pointer for Arc<T> {
25526 impl<T: Default> Default for Arc<T> {
25527 /// Creates a new `Arc<T>`, with the `Default` value for `T`.
25543 impl<T: ?Sized + Hash> Hash for Arc<T> {
25550 impl<T> From<T> for Arc<T> {
25557 impl<T: Clone> From<&[T]> for Arc<[T]> {
25575 impl From<&str> for Arc<str> {
25593 impl From<String> for Arc<str> {
25611 impl<T: ?Sized> From<Box<T>> for Arc<T> {
25629 impl<T> From<Vec<T>> for Arc<[T]> {
25654 impl<'a, B> From<Cow<'a, B>> for Arc<B>
25669 impl<T, const N: usize> TryFrom<Arc<[T]>> for Arc<[T; N]> {
25682 impl<T> iter::FromIterator<T> for Arc<[T]> {
25704 /// .into(); // A second allocation for `Arc<[T]>` happens here.
25708 /// This will allocate as many times as needed for constructing the `Vec<T>`
25709 /// and then it will allocate once for turning the `Vec<T>` into the `Arc<[T]>`.
25714 /// a single allocation will be made for the `Arc<[T]>`. For example:
25726 /// Specialization trait used for collecting into `Arc<[T]>`.
25731 impl<T, I: Iterator<Item = T>> ToArcSlice<T> for I {
25737 impl<T, I: iter::TrustedLen<Item = T>> ToArcSlice<T> for I {
25739 // This is the case for a `TrustedLen` iterator.
25764 impl<T: ?Sized> borrow::Borrow<T> for Arc<T> {
25771 impl<T: ?Sized> AsRef<T> for Arc<T> {
25778 impl<T: ?Sized> Unpin for Arc<T> {}
25780 /// Get the offset within an `ArcInner` for the payload behind a pointer.
25784 /// The pointer must point to (and have valid metadata for) a previously
25801 //! Utilities for formatting and printing `String`s.
25803 //! This module contains the runtime support for the [`format!`] syntax extension.
25829 //! required by the compiler for this to be a string literal; it cannot be a
25903 //! This is a parameter for the "minimum width" that the format should take up.
25908 //! The value for the width can also be provided as a [`usize`] in the list of
25929 //! Filling comes in the following variants for different alignments:
25935 //! The default [fill/alignment](#fillalignment) for non-numerics is a space and
25937 //! default for numeric formatters is also a space character but with right-alignment. If
25938 //! the `0` flag (see below) is specified for numerics, then the implicit fill character is
25942 //! is not generally implemented for the `Debug` trait. A good way to ensure
25962 //! * `+` - This is intended for numeric types and indicates that the sign
25964 //! default, and the negative sign is only printed by default for signed values.
25974 //! * `0` - This is used to indicate for integer formats that the padding to `width` should
25976 //! like `{:08}` would yield `00000001` for the integer `1`, while the
25977 //! same format would yield `-0000001` for the integer `-1`. Notice that
26082 //! The syntax for the formatting language used is drawn from other languages,
26085 //! `%`. The actual grammar for the formatting syntax is:
26126 //! are provided for these traits for a number of primitive types by the
26130 //! When implementing a format trait for your own type, you will have to
26137 //! # impl fmt::Display for Foo {
26173 //! impl fmt::Display for Vector2D {
26184 //! impl fmt::Binary for Vector2D {
26191 //! // documentation for details, and the function `pad` can be used
26215 //! - [`fmt::Debug`][`Debug`] implementations should be implemented for **all** public types.
26233 //! ```ignore (only-for-syntax-highlight)
26777 impl Clone for Fail {
26999 /// documentation for more.
27009 impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
27017 impl<T> Clone for Iter<'_, T> {
27026 /// documentation for more.
27039 impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
27048 /// (provided by the `IntoIterator` trait). See its documentation for more.
27058 impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
27315 impl<T> Default for LinkedList<T> {
27448 /// for element in list.iter_mut() {
27819 for _ in 0..at - 1 {
27826 for _ in 0..len - 1 - (at - 1) {
27867 for _ in 0..at {
27873 for _ in 0..offset_from_end {
27920 unsafe impl<#[may_dangle] T> Drop for LinkedList<T> {
27924 impl<'a, T> Drop for DropGuard<'a, T> {
27941 impl<'a, T> Iterator for Iter<'a, T> {
27971 impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
27989 impl<T> ExactSizeIterator for Iter<'_, T> {}
27992 impl<T> FusedIterator for Iter<'_, T> {}
27995 impl<'a, T> Iterator for IterMut<'a, T> {
28025 impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
28043 impl<T> ExactSizeIterator for IterMut<'_, T> {}
28046 impl<T> FusedIterator for IterMut<'_, T> {}
28065 impl<T> Clone for Cursor<'_, T> {
28073 impl<T: fmt::Debug> fmt::Debug for Cursor<'_, T> {
28097 impl<T: fmt::Debug> fmt::Debug for CursorMut<'_, T> {
28300 /// `CursorMut` is frozen for the lifetime of the `Cursor`.
28477 impl<T, F> Iterator for DrainFilter<'_, T, F>
28506 impl<T, F> Drop for DrainFilter<'_, T, F>
28515 impl<'r, 'a, T, F> Drop for DropGuard<'r, 'a, T, F>
28533 impl<T: fmt::Debug, F> fmt::Debug for DrainFilter<'_, T, F>
28543 impl<T> Iterator for IntoIter<T> {
28558 impl<T> DoubleEndedIterator for IntoIter<T> {
28566 impl<T> ExactSizeIterator for IntoIter<T> {}
28569 impl<T> FusedIterator for IntoIter<T> {}
28572 impl<T> FromIterator<T> for LinkedList<T> {
28581 impl<T> IntoIterator for LinkedList<T> {
28593 impl<'a, T> IntoIterator for &'a LinkedList<T> {
28603 impl<'a, T> IntoIterator for &'a mut LinkedList<T> {
28613 impl<T> Extend<T> for LinkedList<T> {
28624 impl<I: IntoIterator> SpecExtend<I> for LinkedList<I::Item> {
28630 impl<T> SpecExtend<LinkedList<T>> for LinkedList<T> {
28637 impl<'a, T: 'a + Copy> Extend<&'a T> for LinkedList<T> {
28649 impl<T: PartialEq> PartialEq for LinkedList<T> {
28660 impl<T: Eq> Eq for LinkedList<T> {}
28663 impl<T: PartialOrd> PartialOrd for LinkedList<T> {
28670 impl<T: Ord> Ord for LinkedList<T> {
28678 impl<T: Clone> Clone for LinkedList<T> {
28688 for (elem, elem_other) in self.iter_mut().zip(&mut iter_other) {
28698 impl<T: fmt::Debug> fmt::Debug for LinkedList<T> {
28705 impl<T: Hash> Hash for LinkedList<T> {
28708 for elt in self {
28729 unsafe impl<T: Send> Send for LinkedList<T> {}
28732 unsafe impl<T: Sync> Sync for LinkedList<T> {}
28735 unsafe impl<T: Sync> Send for Iter<'_, T> {}
28738 unsafe impl<T: Sync> Sync for Iter<'_, T> {}
28741 unsafe impl<T: Send> Send for IterMut<'_, T> {}
28744 unsafe impl<T: Sync> Sync for IterMut<'_, T> {}
28747 unsafe impl<T: Sync> Send for Cursor<'_, T> {}
28750 unsafe impl<T: Sync> Sync for Cursor<'_, T> {}
28753 unsafe impl<T: Send> Send for CursorMut<'_, T> {}
28756 unsafe impl<T: Sync> Sync for CursorMut<'_, T> {}
28785 (None, _) => panic!("prev link for head"),
28857 for elt in sum {
28880 for elt in u {
28893 for elt in u {
28906 for elt in u {
28928 for _ in 0..25 {
28964 for ix in 0..1 + v1.len() {
28977 for i in 0..sz {
29005 for (a, &b) in m.into_iter().zip(&v) {
29194 /// easier for the caller to avoid a leak when a drop handler panicks.
29199 /// If you want the tree to end up in a strictly ascending order, like for
29216 /// `length` variable along the way. The latter makes it easier for the
29224 for (key, value) in iter {
29256 for _ in 0..tree_height {
29273 // An iterator for merging two sorted sequences into one
29276 impl<K: Ord, V, I> Iterator for MergeIter<K, V, I>
29292 /// A blueprint for crash test dummy instances that monitor particular events.
29369 impl Clone for Instance<'_> {
29379 impl Drop for Instance<'_> {
29388 impl PartialOrd for Instance<'_> {
29394 impl Ord for Instance<'_> {
29400 impl PartialEq for Instance<'_> {
29406 impl Eq for Instance<'_> {}
29448 impl PartialOrd for Cyclic3 {
29454 impl Ord for Cyclic3 {
29464 impl PartialEq for Cyclic3 {
29470 impl Eq for Cyclic3 {}
29494 impl<T: Ord> PartialOrd for Governed<'_, T> {
29500 impl<T: Ord> Ord for Governed<'_, T> {
29508 impl<T: PartialEq> PartialEq for Governed<'_, T> {
29515 impl<T: Eq> Eq for Governed<'_, T> {}
29529 /// An inclusive bound to look for, just like `Bound::Included(T)`.
29531 /// An exclusive bound to look for, just like `Bound::Excluded(T)`.
29591 /// pair of bounds for continuing the search in the child nodes, in case
29661 /// Also returns the lower bound to be used for continuing the search in
29678 /// Clone of `find_lower_bound_edge` for the upper bound.
29719 /// `start_index` must be a valid edge index for the node.
29728 for (offset, k) in unsafe { keys.get_unchecked(start_index..) }.iter().enumerate() {
29739 /// Also returns the lower bound to be used for continuing the search in
29765 /// Mirror image of `find_lower_bound_index` for the upper bound,
29769 /// `start_index` must be a valid edge index for the node.
29828 /// choice for a sorted map, as a perfectly balanced BST performs the theoretical minimum amount of
29830 /// is done is *very* inefficient for modern computer architectures. In particular, every element
29842 /// that initially only checks every i<sup>th</sup> element for some choice of i.
29847 /// and possibly other factors. Using linear search, searching for a random element is expected
29851 /// It is a logic error for a key to be modified in such a way that the key's ordering relative to
29877 /// // check for a specific one.
29888 /// for movie in &to_find {
29895 /// // Look up the value for a key (will panic if the key is not found).
29899 /// for (movie, review) in &movie_reviews {
29904 /// `BTreeMap` also implements an [`Entry API`], which allows for more complex
29918 /// // some fixed value for now
29941 unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> {
29950 impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
30026 impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
30068 /// documentation for more.
30078 impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
30087 /// documentation for more.
30100 /// (provided by the `IntoIterator` trait). See its documentation for more.
30119 impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> {
30136 /// documentation for more.
30145 impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> {
30154 /// documentation for more.
30163 impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
30172 /// documentation for more.
30181 impl<K, V: fmt::Debug> fmt::Debug for ValuesMut<'_, K, V> {
30190 /// See its documentation for more.
30199 impl<K: fmt::Debug, V> fmt::Debug for IntoKeys<K, V> {
30208 /// See its documentation for more.
30217 impl<K, V: fmt::Debug> fmt::Debug for IntoValues<K, V> {
30226 /// documentation for more.
30235 impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Range<'_, K, V> {
30244 /// documentation for more.
30256 impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for RangeMut<'_, K, V> {
30392 /// Returns the first entry in the map for in-place manipulation.
30475 /// Returns the last entry in the map for in-place manipulation.
30533 /// Returns `true` if the map contains a value for the specified key.
30578 // See `get` for implementation notes, this is basically a copy-paste with mut's added
30597 /// value is returned. The key is not updated, though; this matters for
30599 /// documentation] for more.
30805 /// The range may also be entered as `(Bound<T>, Bound<T>)`, so for example
30826 /// for (&key, &value) in map.range((Included(&4), Included(&8))) {
30848 /// The range may also be entered as `(Bound<T>, Bound<T>)`, so for example
30868 /// for (_, balance) in map.range_mut("B".."Cheryl") {
30871 /// for (name, balance) in &map {
30889 /// Gets the given key's corresponding entry in the map for in-place manipulation.
30901 /// for x in vec!["a", "b", "a", "c", "a", "b"] {
31078 impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
31088 impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> {
31118 impl<K, V> FusedIterator for Iter<'_, K, V> {}
31121 impl<'a, K: 'a, V: 'a> DoubleEndedIterator for Iter<'a, K, V> {
31133 impl<K, V> ExactSizeIterator for Iter<'_, K, V> {
31140 impl<K, V> Clone for Iter<'_, K, V> {
31147 impl<'a, K, V> IntoIterator for &'a mut BTreeMap<K, V> {
31157 impl<'a, K: 'a, V: 'a> Iterator for IterMut<'a, K, V> {
31187 impl<'a, K: 'a, V: 'a> DoubleEndedIterator for IterMut<'a, K, V> {
31199 impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {
31206 impl<K, V> FusedIterator for IterMut<'_, K, V> {}
31217 impl<K, V> IntoIterator for BTreeMap<K, V> {
31233 impl<K, V> Drop for Dropper<K, V> {
31248 impl<'a, K, V> Drop for DropGuard<'a, K, V> {
31265 impl<K, V> Drop for IntoIter<K, V> {
31274 impl<K, V> Iterator for IntoIter<K, V> {
31292 impl<K, V> DoubleEndedIterator for IntoIter<K, V> {
31304 impl<K, V> ExactSizeIterator for IntoIter<K, V> {
31311 impl<K, V> FusedIterator for IntoIter<K, V> {}
31314 impl<'a, K, V> Iterator for Keys<'a, K, V> {
31339 impl<'a, K, V> DoubleEndedIterator for Keys<'a, K, V> {
31346 impl<K, V> ExactSizeIterator for Keys<'_, K, V> {
31353 impl<K, V> FusedIterator for Keys<'_, K, V> {}
31356 impl<K, V> Clone for Keys<'_, K, V> {
31363 impl<'a, K, V> Iterator for Values<'a, K, V> {
31380 impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
31387 impl<K, V> ExactSizeIterator for Values<'_, K, V> {
31394 impl<K, V> FusedIterator for Values<'_, K, V> {}
31397 impl<K, V> Clone for Values<'_, K, V> {
31415 /// of the predicate, thus also serving for BTreeSet::DrainFilter.
31429 impl<K, V, F> Drop for DrainFilter<'_, K, V, F>
31439 impl<K, V, F> fmt::Debug for DrainFilter<'_, K, V, F>
31451 impl<K, V, F> Iterator for DrainFilter<'_, K, V, F>
31508 impl<K, V, F> FusedIterator for DrainFilter<'_, K, V, F> where F: FnMut(&K, &mut V) -> bool {}
31511 impl<'a, K, V> Iterator for Range<'a, K, V> {
31532 impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
31549 impl<'a, K, V> DoubleEndedIterator for ValuesMut<'a, K, V> {
31556 impl<K, V> ExactSizeIterator for ValuesMut<'_, K, V> {
31563 impl<K, V> FusedIterator for ValuesMut<'_, K, V> {}
31572 impl<K, V> Iterator for IntoKeys<K, V> {
31597 impl<K, V> DoubleEndedIterator for IntoKeys<K, V> {
31604 impl<K, V> ExactSizeIterator for IntoKeys<K, V> {
31611 impl<K, V> FusedIterator for IntoKeys<K, V> {}
31614 impl<K, V> Iterator for IntoValues<K, V> {
31631 impl<K, V> DoubleEndedIterator for IntoValues<K, V> {
31638 impl<K, V> ExactSizeIterator for IntoValues<K, V> {
31645 impl<K, V> FusedIterator for IntoValues<K, V> {}
31648 impl<'a, K, V> DoubleEndedIterator for Range<'a, K, V> {
31661 impl<K, V> FusedIterator for Range<'_, K, V> {}
31664 impl<K, V> Clone for Range<'_, K, V> {
31671 impl<'a, K, V> Iterator for RangeMut<'a, K, V> {
31704 impl<'a, K, V> DoubleEndedIterator for RangeMut<'a, K, V> {
31711 impl<K, V> FusedIterator for RangeMut<'_, K, V> {}
31720 impl<K: Ord, V> FromIterator<(K, V)> for BTreeMap<K, V> {
31729 impl<K: Ord, V> Extend<(K, V)> for BTreeMap<K, V> {
31744 impl<'a, K: Ord + Copy, V: Copy> Extend<(&'a K, &'a V)> for BTreeMap<K, V> {
31756 impl<K: Hash, V: Hash> Hash for BTreeMap<K, V> {
31758 for elt in self {
31765 impl<K: Ord, V> Default for BTreeMap<K, V> {
31773 impl<K: PartialEq, V: PartialEq> PartialEq for BTreeMap<K, V> {
31780 impl<K: Eq, V: Eq> Eq for BTreeMap<K, V> {}
31783 impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V> {
31791 impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
31799 impl<K: Debug, V: Debug> Debug for BTreeMap<K, V> {
31806 impl<K, Q: ?Sized, V> Index<&Q> for BTreeMap<K, V>
31820 self.get(key).expect("no entry found for key")
31839 /// for (key, value) in map.iter() {
31872 /// for (key, value) in map.iter_mut() {
31950 /// for value in a.values_mut() {
32021 /// The borrow checker usually handles this stacking of borrows for you, but
32022 /// some control flows that accomplish this stacking are too complicated for
32031 unsafe impl<'a, T> Sync for DormantMutRef<'a, T> where &'a mut T: Sync {}
32032 unsafe impl<'a, T> Send for DormantMutRef<'a, T> where &'a mut T: Send {}
32037 /// original reference, but you promise to use it for a shorter period.
32068 #[allow(dead_code)] // keep as illustration and for future use
32081 impl Drop for PanicGuard {
32161 for _ in 0..height {
32185 /// See [`BTreeMap`]'s documentation for a detailed discussion of this collection's performance
32188 /// It is a logic error for an item to be modified in such a way that the item's ordering relative
32214 /// // Check for a specific one.
32224 /// for book in &books {
32236 impl<T: Clone> Clone for BTreeSet<T> {
32249 /// See its documentation for more.
32258 impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
32267 /// (provided by the `IntoIterator` trait). See its documentation for more.
32279 /// See its documentation for more.
32291 /// See its documentation for more.
32314 impl<T: fmt::Debug> fmt::Debug for Difference<'_, T> {
32323 /// [`BTreeSet`]. See its documentation for more.
32330 impl<T: fmt::Debug> fmt::Debug for SymmetricDifference<'_, T> {
32339 /// See its documentation for more.
32362 impl<T: fmt::Debug> fmt::Debug for Intersection<'_, T> {
32371 /// See its documentation for more.
32378 impl<T: fmt::Debug> fmt::Debug for Union<'_, T> {
32417 /// The range may also be entered as `(Bound<T>, Bound<T>)`, so for example
32431 /// for &elem in set.range((Included(&4), Included(&8))) {
32680 /// This is equivalent to checking for an empty intersection.
32759 for next in self_iter {
32915 /// entry is not updated. See the [module-level documentation] for more.
33217 impl<T: Ord> FromIterator<T> for BTreeSet<T> {
33226 impl<T> IntoIterator for BTreeSet<T> {
33230 /// Gets an iterator for moving out the `BTreeSet`'s contents.
33248 impl<'a, T> IntoIterator for &'a BTreeSet<T> {
33269 impl<T, F> Drop for DrainFilter<'_, T, F>
33279 impl<T, F> fmt::Debug for DrainFilter<'_, T, F>
33290 impl<'a, T, F> Iterator for DrainFilter<'_, T, F>
33308 impl<T, F> FusedIterator for DrainFilter<'_, T, F> where F: FnMut(&T) -> bool {}
33311 impl<T: Ord> Extend<T> for BTreeSet<T> {
33326 impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BTreeSet<T> {
33338 impl<T: Ord> Default for BTreeSet<T> {
33346 impl<T: Ord + Clone> Sub<&BTreeSet<T>> for &BTreeSet<T> {
33369 impl<T: Ord + Clone> BitXor<&BTreeSet<T>> for &BTreeSet<T> {
33392 impl<T: Ord + Clone> BitAnd<&BTreeSet<T>> for &BTreeSet<T> {
33415 impl<T: Ord + Clone> BitOr<&BTreeSet<T>> for &BTreeSet<T> {
33438 impl<T: Debug> Debug for BTreeSet<T> {
33445 impl<T> Clone for Iter<'_, T> {
33451 impl<'a, T> Iterator for Iter<'a, T> {
33475 impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
33481 impl<T> ExactSizeIterator for Iter<'_, T> {
33488 impl<T> FusedIterator for Iter<'_, T> {}
33491 impl<T> Iterator for IntoIter<T> {
33503 impl<T> DoubleEndedIterator for IntoIter<T> {
33509 impl<T> ExactSizeIterator for IntoIter<T> {
33516 impl<T> FusedIterator for IntoIter<T> {}
33519 impl<T> Clone for Range<'_, T> {
33526 impl<'a, T> Iterator for Range<'a, T> {
33547 impl<'a, T> DoubleEndedIterator for Range<'a, T> {
33554 impl<T> FusedIterator for Range<'_, T> {}
33557 impl<T> Clone for Difference<'_, T> {
33574 impl<'a, T: Ord> Iterator for Difference<'a, T> {
33621 impl<T: Ord> FusedIterator for Difference<'_, T> {}
33624 impl<T> Clone for SymmetricDifference<'_, T> {
33630 impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> {
33656 impl<T: Ord> FusedIterator for SymmetricDifference<'_, T> {}
33659 impl<T> Clone for Intersection<'_, T> {
33675 impl<'a, T: Ord> Iterator for Intersection<'a, T> {
33716 impl<T: Ord> FusedIterator for Intersection<'_, T> {}
33719 impl<T> Clone for Union<'_, T> {
33725 impl<'a, T: Ord> Iterator for Union<'a, T> {
33745 impl<T: Ord> FusedIterator for Union<'_, T> {}
34239 /// Returns the leaf edge closest to a KV for forward navigation.
34250 /// Returns the leaf edge closest to a KV for backward navigation.
34350 for x in a {
34353 for y in b {
34714 for x in &xs {
34766 impl PartialEq for Foo {
34772 impl Eq for Foo {}
34774 impl PartialOrd for Foo {
34780 impl Ord for Foo {
34959 for i in 3..=12 {
35034 for factor in [2, 3, 7].iter() {
35073 impl<K: Debug + Ord, V: Debug> Debug for Entry<'_, K, V> {
35095 impl<K: Debug + Ord, V> Debug for VacantEntry<'_, K, V> {
35113 impl<K: Debug + Ord, V: Debug> Debug for OccupiedEntry<'_, K, V> {
35131 impl<K: Debug + Ord, V: Debug> Debug for OccupiedError<'_, K, V> {
35142 impl<'a, K: Debug + Ord, V: Debug> fmt::Display for OccupiedError<'a, K, V> {
35200 /// This method allows for generating key-derived values for insertion by providing the default
35597 for r in refs.iter_mut() {
35600 for r in refs {
35664 for next in keys {
35688 for idx in 0..=node.len() {
35762 for i in 0..size {
35772 for i in 0..size {
35776 for i in size..size * 2 {
35780 for i in 0..size {
35785 for i in 0..size {
35789 for i in 0..size / 2 {
35794 for i in 0..size / 2 {
35799 for i in 0..size / 2 {
35904 for i in 0..size {
35927 for i in 0..size {
35953 for (i, (k, v)) in map.iter_mut().enumerate() {
35960 for (i, (k, v)) in map.iter_mut().rev().enumerate() {
35967 for (i, (k, v)) in map.iter_mut().enumerate() {
35978 impl TryFrom<usize> for Align32 {
36023 for value in a.values_mut() {
36075 for i in 0..size / 4 {
36080 for i in size / 4..size * 3 / 4 {
36203 for root in middle - 2..=middle + 2 {
36352 impl PartialOrd for EvilTwin {
36359 impl Ord for EvilTwin {
36366 impl PartialEq for EvilTwin {
36372 impl Eq for EvilTwin {}
36377 impl Borrow<EvilTwin> for CompositeKey {
36397 for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) {
36432 for i in (0..size).step_by(step) {
36433 for j in (i..size).step_by(step) {
36437 for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) {
36453 for i in (0..size).step_by(step) {
36454 for j in (i..size).step_by(step) {
36458 for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) {
36554 for doomed in 0..3 {
36565 for sacred in 0..3 {
36594 for doomed in 0..NODE_CAPACITY {
36605 for sacred in 0..NODE_CAPACITY {
36642 for doomed in 0..MIN_INSERTS_HEIGHT_1 {
36653 for sacred in 0..MIN_INSERTS_HEIGHT_1 {
36664 for doomed in (0..MIN_INSERTS_HEIGHT_2).step_by(12) {
36675 for sacred in (0..MIN_INSERTS_HEIGHT_2).step_by(12) {
36927 for _ in 0..100 {
36944 impl PartialEq for Bad {
36950 impl Eq for Bad {}
36952 impl PartialOrd for Bad {
36958 impl Ord for Bad {
36966 for _ in 0..100 {
36975 for &len in &[MIN_INSERTS_HEIGHT_1, MIN_INSERTS_HEIGHT_2, 0, NODE_CAPACITY] {
36976 for i in 0..len {
37015 for i in 0..size {
37022 for i in 0..size {
37029 for i in 0..size / 2 {
37036 for i in 0..size / 2 {
37089 for i in 0..=max_size {
37091 for j in 0..i {
37419 for pos in 0..=size {
37429 for pos in 0..=size {
37447 for i in 0..8 {
37452 for i in 5..$len {
37461 for i in 0..$len {
37477 // These are mostly for testing the algorithm that "fixes" the right edge after insertion.
37490 // Tests for several randomly chosen sizes.
37513 assert_eq!(b.dropped(), 1); // should be 2 were it not for Rust issue #47949
37606 for &len in &[NODE_CAPACITY, 25, 50, 75, 100] {
37665 for panic_point in vec![0, 1, size - 2, size - 1] {
37674 for i in 0..size {
37710 for _ in 0..loops {
37725 for _ in 0..loops {
37762 // distinct node type for the immediate parents of a leaf.
37811 // for the reasons listed in `choose_parent_kv`.
37829 /// for instance a union or a symmetric difference.
37844 impl<I: Iterator> Clone for MergeIterInner<I>
37854 impl<I: Iterator> Debug for MergeIterInner<I>
37865 /// Creates a new core for an iterator merging a pair of sources.
37910 /// Returns a pair of upper bounds for the `size_hint` of the final iterator.
38017 // gdb_providers.py uses this type name for introspection.
38086 /// or for one particular type. For example, we cannot define a method like
38087 /// `into_kv` generically for all `BorrowType`, or once for all types that
38089 /// Therefore, we define it only for the least powerful type `Immut<'a>`.
38121 impl<'a, K: 'a, V: 'a, Type> Copy for NodeRef<marker::Immut<'a>, K, V, Type> {}
38122 impl<'a, K: 'a, V: 'a, Type> Clone for NodeRef<marker::Immut<'a>, K, V, Type> {
38128 unsafe impl<BorrowType, K: Sync, V: Sync, Type> Sync for NodeRef<BorrowType, K, V, Type> {}
38130 unsafe impl<'a, K: Sync + 'a, V: Sync + 'a, Type> Send for NodeRef<marker::Immut<'a>, K, V, Type> {}
38131 unsafe impl<'a, K: Send + 'a, V: Send + 'a, Type> Send for NodeRef<marker::Mut<'a>, K, V, Type> {}
38132 unsafe impl<'a, K: Send + 'a, V: Send + 'a, Type> Send for NodeRef<marker::ValMut<'a>, K, V, Type> {}
38133 unsafe impl<K: Send, V: Send, Type> Send for NodeRef<marker::Owned, K, V, Type> {}
38134 unsafe impl<K: Send, V: Send, Type> Send for NodeRef<marker::Dying, K, V, Type> {}
38219 // The node must be valid for at least the LeafNode portion.
38372 // for the lifetime of the borrow.
38386 // for the lifetime of the borrow.
38392 /// Borrows exclusive access to an element or slice of the node's storage area for edge contents.
38402 // for the lifetime of the borrow.
38435 /// Every item returned by `range` is a valid edge index for the node.
38437 for i in range {
38632 impl<Node: Copy, Type> Copy for Handle<Node, Type> {}
38635 impl<Node: Copy, Type> Clone for Handle<Node, Type> {
38672 for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType>
38737 /// The goal of the split point is for its key and value to end up in a parent node;
38753 /// this edge. This method assumes that there is enough space in the node for the new
38814 /// that there is enough space in the node for the new pair to fit.
38972 /// Helps implementations of `split` for a particular `NodeType`,
39057 /// Represents a session for evaluating and performing a balancing operation
39284 // Make room for stolen elements in the right child.
39310 // Make room for stolen edges.
39549 impl BorrowType for Owned {
39555 impl BorrowType for Dying {}
39556 impl<'a> BorrowType for Immut<'a> {}
39557 impl<'a> BorrowType for Mut<'a> {}
39558 impl<'a> BorrowType for ValMut<'a> {}
39639 for idx in 0..=node.len() {
39675 for idx in 0..=CAPACITY {
39948 /// The error type for `try_reserve` methods.
39975 impl From<LayoutError> for TryReserveError {
39983 impl Display for TryReserveError {
39999 /// An intermediate trait for specialization of `Extend`.
40013 /// (provided by the `IntoIterator` trait). See its documentation for more.
40023 impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
40030 impl<T> Iterator for IntoIter<T> {
40051 // Additionally Self: TrustedRandomAccess is only implemented for T: Copy which means even
40062 impl<T> DoubleEndedIterator for IntoIter<T> {
40070 impl<T> ExactSizeIterator for IntoIter<T> {
40077 impl<T> FusedIterator for IntoIter<T> {}
40080 unsafe impl<T> TrustedLen for IntoIter<T> {}
40084 // T: Copy as approximation for !Drop since get_unchecked does not update the pointers
40086 unsafe impl<T> TrustedRandomAccess for IntoIter<T>
40095 impl<A, B, $($vars)*> PartialEq<$rhs> for $lhs
40120 /// documentation for more.
40132 impl<T: fmt::Debug> fmt::Debug for Drain<'_, T> {
40143 unsafe impl<T: Sync> Sync for Drain<'_, T> {}
40145 unsafe impl<T: Send> Send for Drain<'_, T> {}
40148 impl<T> Drop for Drain<'_, T> {
40152 impl<'r, 'a, T> Drop for DropGuard<'r, 'a, T> {
40209 impl<T> Iterator for Drain<'_, T> {
40224 impl<T> DoubleEndedIterator for Drain<'_, T> {
40232 impl<T> ExactSizeIterator for Drain<'_, T> {}
40235 impl<T> FusedIterator for Drain<'_, T> {}
40256 impl<T> RingSlices for &[T] {
40265 impl<T> RingSlices for &mut [T] {
40274 impl<T> RingSlices for *mut [T] {
40335 impl<'a, 'b, T> Iterator for PairSlices<'a, 'b, T> {
40428 /// in memory. If you want to access the elements as a single slice, such as for
40452 impl<T: Clone> Clone for VecDeque<T> {
40466 for remainder in iter.remainder() {
40474 unsafe impl<#[may_dangle] T> Drop for VecDeque<T> {
40476 /// Runs the destructor for all items in the slice when it gets dropped (normally or
40480 impl<'a, T> Drop for Dropper<'a, T> {
40491 // use drop for [T]
40499 impl<T> Default for VecDeque<T> {
40557 /// Returns the index in the underlying buffer for a given logical element
40564 /// Returns the index in the underlying buffer for a given logical element
40571 /// Returns the index in the underlying buffer for a given logical element
40822 /// Creates an empty `VecDeque` with space for at least `capacity` elements.
40943 /// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
40970 /// Reserves capacity for at least `additional` more elements to be inserted in the given
41003 /// Tries to reserve the minimum capacity for exactly `additional` more elements to
41044 /// Tries to reserve capacity for at least `additional` more elements to be inserted
41098 /// `VecDeque` that there is space for a few more elements.
41221 /// Runs the destructor for all items in the slice when it gets dropped (normally or
41225 impl<'a, T> Drop for Dropper<'a, T> {
41295 /// for num in buf.iter_mut() {
41304 // `ring` we create is a dereferencable slice for lifetime '_.
41477 /// for v in v.range_mut(2..) {
41483 /// for v in v.range_mut(..) {
41497 // `ring` we create is a dereferencable slice for lifetime '_.
41584 // Hence the raw pointer we created above, for `deque`, remains valid.
42163 // x - Element marked for removal
42411 /// The exact order may be useful for tracking external state, like an index.
42431 for i in 0..len {
42623 for i in left_edge..right_edge {
42669 /// for i in 1..10 {
42712 /// for i in 1..10 {
42755 /// Binary searches this sorted `VecDeque` for a given element.
42866 /// Assumes that the `VecDeque` is sorted by the key, for instance with
42917 /// This means that all elements for which the predicate returns true are at the start of the deque
42918 /// and all elements for which the predicate returns false are at the end.
42987 /// Returns the index in the underlying buffer for a given logical element index.
43003 impl<A: PartialEq> PartialEq for VecDeque<A> {
43013 // Always divisible in three sections, for example:
43042 impl<A: Eq> Eq for VecDeque<A> {}
43052 impl<A: PartialOrd> PartialOrd for VecDeque<A> {
43059 impl<A: Ord> Ord for VecDeque<A> {
43067 impl<A: Hash> Hash for VecDeque<A> {
43074 // Hasher only guarantees equivalence for the exact same
43081 impl<A> Index<usize> for VecDeque<A> {
43091 impl<A> IndexMut<usize> for VecDeque<A> {
43099 impl<A> FromIterator<A> for VecDeque<A> {
43110 impl<T> IntoIterator for VecDeque<T> {
43122 impl<'a, T> IntoIterator for &'a VecDeque<T> {
43132 impl<'a, T> IntoIterator for &'a mut VecDeque<T> {
43142 impl<A> Extend<A> for VecDeque<A> {
43146 // for item in iter.into_iter() {
43176 impl<'a, T: 'a + Copy> Extend<&'a T> for VecDeque<T> {
43193 impl<T: fmt::Debug> fmt::Debug for VecDeque<T> {
43200 impl<T> From<Vec<T>> for VecDeque<T> {
43206 /// This avoids reallocating where possible, but the conditions for that are
43212 // There's no actual allocation for ZSTs to worry about capacity,
43235 impl<T> From<VecDeque<T>> for Vec<T> {
43290 /// documentation for more.
43301 impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
43310 impl<T> Clone for Iter<'_, T> {
43317 impl<'a, T> Iterator for Iter<'a, T> {
43400 impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
43445 impl<T> ExactSizeIterator for Iter<'_, T> {
43452 impl<T> FusedIterator for Iter<'_, T> {}
43455 unsafe impl<T> TrustedLen for Iter<'_, T> {}
43459 unsafe impl<T> TrustedRandomAccess for Iter<'_, T> {
43469 for i in 0..100 {
43482 for i in 0..100 {
43527 for len in 0..final_len {
43530 for tail_pos in 0..usable_cap {
43534 for i in 0..len * 2 {
43537 for i in 0..len {
43541 for i in 0..len * 2 {
43544 for i in 0..len {
43566 // 15 would be great, but we will definitely get 2^k - 1, for k >= 4, or else
43572 for len in minlen..cap {
43575 for tail_pos in 0..cap {
43576 for to_insert in 0..len {
43579 for i in 0..len {
43597 for i in 0..3 {
43601 for i in 3..10 {
43619 for i in 0..8 {
43623 for i in 8..10 {
43638 for i in 'A' as u8..'I' as u8 {
43642 for i in 'I' as u8..'N' as u8 {
43656 for i in 'I' as u8..'N' as u8 {
43660 for i in 'A' as u8..'I' as u8 {
43690 // Another test case for #79808, taken from #80293.
43710 // 15 would be great, but we will definitely get 2^k - 1, for k >= 4, or else
43716 for len in minlen..cap - 1 {
43719 for tail_pos in 0..cap {
43720 for to_remove in 0..=len {
43723 for i in 0..len {
43747 for len in minlen..=cap {
43748 for tail in 0..=cap {
43749 for start in 0..=len {
43750 for end in start..=len {
43753 for i in 0..len {
43772 for len in 0..=cap {
43773 for tail in 0..=cap {
43774 for start in 0..=len {
43775 for end in start..=len {
43778 for i in 0..len {
43806 for len in 0..=cap {
43807 for tail in 0..=cap {
43808 for drain_start in 0..=len {
43809 for drain_end in drain_start..=len {
43812 for i in 0..len {
43843 // 15 would be great, but we will definitely get 2^k - 1, for k >= 4, or else
43849 for len in 0..=cap {
43852 for tail_pos in 0..=max_cap {
43856 for i in 0..len {
43875 // 15 would be great, but we will definitely get 2^k - 1, for k >= 4, or else
43881 for len in minlen..cap {
43883 for at in 0..=len {
43889 for tail_pos in 0..cap {
43892 for i in 0..len {
43910 for cap in 0..35 {
43911 for len in 0..=cap {
43933 let vd = VecDeque::from(vec.clone()); // no room for +1
43944 for _ in 0..offset {
43958 for cap_pwr in 0..max_pwr {
43963 for len in 0..((cap + 1) / 2) {
43965 for offset in 0..(cap - len) {
43970 for offset in (cap - len)..(cap - (len / 2)) {
43975 for offset in (cap - (len / 2))..cap {
43984 for len in ((cap + 1) / 2)..cap {
43986 for offset in 0..(cap - len) {
43991 for offset in (cap - len)..(cap - (len / 2)) {
43996 for offset in (cap - (len / 2))..cap {
44008 for pfv in 0..limit {
44009 for pfu in 0..limit {
44010 for longer in 0..2 {
44013 for _ in 0..pfv {
44017 for _ in 0..pfu {
44032 impl Drop for Elem {
44041 for push_front in 0..=v.len() {
44044 for (index, elem) in v.into_iter().enumerate() {
44074 for a in dst {
44087 impl Hasher for SimpleHasher {
44095 // for the exact same set of calls to its methods.
44096 for &v in iter::once(&24).chain(bytes) {
44108 // This creates two deques for which values returned by as_slices
44127 /// documentation for more.
44142 unsafe impl<T: Send> Send for IterMut<'_, T> {}
44144 unsafe impl<T: Sync> Sync for IterMut<'_, T> {}
44147 impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> {
44158 impl<'a, T> Iterator for IterMut<'a, T> {
44223 impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
44251 impl<T> ExactSizeIterator for IterMut<'_, T> {
44258 impl<T> FusedIterator for IterMut<'_, T> {}
44261 unsafe impl<T> TrustedLen for IterMut<'_, T> {}
44265 unsafe impl<T> TrustedRandomAccess for IterMut<'_, T> {
44273 //! converted to a sorted vector in-place, allowing it to be used for an *O*(*n* \* log(*n*))
44299 //! impl Ord for State {
44310 //! impl PartialOrd for State {
44316 //! // Each node is represented as an `usize`, for a shorter implementation.
44327 //! // for a simpler implementation.
44348 //! for edge in &adj_list[position] {
44385 //! // Chosen for its efficiency.
44428 /// It is a logic error for an item to be modified in such a way that the
44462 /// for x in &heap {
44509 /// The value for `push` is an expected cost; the method documentation gives a
44526 /// its documentation for more.
44536 impl<T: Ord + fmt::Debug> fmt::Debug for PeekMut<'_, T> {
44543 impl<T: Ord> Drop for PeekMut<'_, T> {
44546 // SAFETY: PeekMut is only instantiated for non-empty heaps.
44553 impl<T: Ord> Deref for PeekMut<'_, T> {
44557 // SAFE: PeekMut is only instantiated for non-empty heaps
44563 impl<T: Ord> DerefMut for PeekMut<'_, T> {
44567 // SAFE: PeekMut is only instantiated for non-empty heaps
44583 impl<T: Clone> Clone for BinaryHeap<T> {
44594 impl<T: Ord> Default for BinaryHeap<T> {
44603 impl<T: fmt::Debug> fmt::Debug for BinaryHeap<T> {
44627 /// This preallocates enough memory for `capacity` elements,
44952 for i in start..self.len() {
45009 /// You should use the latter for most cases.
45083 /// for x in heap.iter() {
45154 /// Reserves the minimum capacity for exactly `additional` more elements to be inserted in the
45183 /// Reserves capacity for at least `additional` more elements to be inserted in the
45283 /// for x in vec {
45347 /// for x in heap.drain() {
45441 impl<T> Drop for Hole<'_, T> {
45455 /// documentation for more.
45464 impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> {
45472 impl<T> Clone for Iter<'_, T> {
45479 impl<'a, T> Iterator for Iter<'a, T> {
45499 impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
45507 impl<T> ExactSizeIterator for Iter<'_, T> {
45514 impl<T> FusedIterator for Iter<'_, T> {}
45519 /// (provided by the `IntoIterator` trait). See its documentation for more.
45529 impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
45536 impl<T> Iterator for IntoIter<T> {
45551 impl<T> DoubleEndedIterator for IntoIter<T> {
45559 impl<T> ExactSizeIterator for IntoIter<T> {
45566 impl<T> FusedIterator for IntoIter<T> {}
45569 unsafe impl<T> SourceIter for IntoIter<T> {
45579 unsafe impl<I> InPlaceIterable for IntoIter<I> {}
45581 impl<I> AsIntoIter for IntoIter<I> {
45596 impl<T: Ord> Iterator for IntoIterSorted<T> {
45612 impl<T: Ord> ExactSizeIterator for IntoIterSorted<T> {}
45615 impl<T: Ord> FusedIterator for IntoIterSorted<T> {}
45618 unsafe impl<T: Ord> TrustedLen for IntoIterSorted<T> {}
45623 /// documentation for more.
45633 impl<T> Iterator for Drain<'_, T> {
45648 impl<T> DoubleEndedIterator for Drain<'_, T> {
45656 impl<T> ExactSizeIterator for Drain<'_, T> {
45663 impl<T> FusedIterator for Drain<'_, T> {}
45668 /// documentation for more.
45678 impl<'a, T: Ord> Drop for DrainSorted<'a, T> {
45683 impl<'r, 'a, T: Ord> Drop for DropGuard<'r, 'a, T> {
45698 impl<T: Ord> Iterator for DrainSorted<'_, T> {
45714 impl<T: Ord> ExactSizeIterator for DrainSorted<'_, T> {}
45717 impl<T: Ord> FusedIterator for DrainSorted<'_, T> {}
45720 unsafe impl<T: Ord> TrustedLen for DrainSorted<'_, T> {}
45723 impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
45735 impl<T> From<BinaryHeap<T>> for Vec<T> {
45746 impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
45753 impl<T> IntoIterator for BinaryHeap<T> {
45770 /// for x in heap.into_iter() {
45781 impl<'a, T> IntoIterator for &'a BinaryHeap<T> {
45791 impl<T: Ord> Extend<T> for BinaryHeap<T> {
45808 impl<T: Ord, I: IntoIterator<Item = T>> SpecExtend<I> for BinaryHeap<T> {
45814 impl<T: Ord> SpecExtend<BinaryHeap<T>> for BinaryHeap<T> {
45832 impl<'a, T: 'a + Ord + Copy> Extend<&'a T> for BinaryHeap<T> {
45882 impl<T: fmt::Debug, A: Allocator> fmt::Debug for IntoIter<T, A> {
45961 impl<T, A: Allocator> AsRef<[T]> for IntoIter<T, A> {
45968 unsafe impl<T: Send, A: Allocator + Send> Send for IntoIter<T, A> {}
45970 unsafe impl<T: Sync, A: Allocator> Sync for IntoIter<T, A> {}
45973 impl<T, A: Allocator> Iterator for IntoIter<T, A> {
45981 // purposefully don't use 'ptr.offset' because for
46022 // them for `Drop`.
46030 impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A> {
46036 // See above for why 'ptr.offset' isn't used
46050 impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A> {
46057 impl<T, A: Allocator> FusedIterator for IntoIter<T, A> {}
46060 unsafe impl<T, A: Allocator> TrustedLen for IntoIter<T, A> {}
46064 // T: Copy as approximation for !Drop since get_unchecked does not advance self.ptr
46066 unsafe impl<T, A: Allocator> TrustedRandomAccess for IntoIter<T, A>
46074 impl<T: Clone, A: Allocator + Clone> Clone for IntoIter<T, A> {
46086 unsafe impl<#[may_dangle] T, A: Allocator> Drop for IntoIter<T, A> {
46090 impl<T, A: Allocator> Drop for DropGuard<'_, T, A> {
46111 unsafe impl<T, A: Allocator> InPlaceIterable for IntoIter<T, A> {}
46114 unsafe impl<T, A: Allocator> SourceIter for IntoIter<T, A> {
46123 // internal helper trait for in-place iteration specialization.
46130 impl<T> AsIntoIter for IntoIter<T> {
46144 // Specialization trait used for Vec::extend
46149 impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
46158 impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
46163 // This is the case for a TrustedLen iterator.
46187 // This avoids additional codegen for a fallback code path which would eventually
46194 impl<T, A: Allocator> SpecExtend<T, IntoIter<T>> for Vec<T, A> {
46203 impl<'a, T: 'a, I, A: Allocator + 'a> SpecExtend<&'a T, I> for Vec<T, A>
46213 impl<'a, T: 'a, A: Allocator + 'a> SpecExtend<&'a T, slice::Iter<'a, T>> for Vec<T, A>
46228 // Specialization trait used for Vec::from_elem
46233 impl<T: Clone> SpecFromElem for T {
46241 impl SpecFromElem for i8 {
46256 impl SpecFromElem for u8 {
46271 impl<T: Clone + IsZero> SpecFromElem for T {
46291 /// A draining iterator for `Vec<T>`.
46294 /// See its documentation for more.
46318 impl<T: fmt::Debug, A: Allocator> fmt::Debug for Drain<'_, T, A> {
46350 impl<'a, T, A: Allocator> AsRef<[T]> for Drain<'a, T, A> {
46357 unsafe impl<T: Sync, A: Sync + Allocator> Sync for Drain<'_, T, A> {}
46359 unsafe impl<T: Send, A: Send + Allocator> Send for Drain<'_, T, A> {}
46362 impl<T, A: Allocator> Iterator for Drain<'_, T, A> {
46376 impl<T, A: Allocator> DoubleEndedIterator for Drain<'_, T, A> {
46384 impl<T, A: Allocator> Drop for Drain<'_, T, A> {
46390 impl<'r, 'a, T, A: Allocator> Drop for DropGuard<'r, 'a, T, A> {
46426 impl<T, A: Allocator> ExactSizeIterator for Drain<'_, T, A> {
46433 unsafe impl<T, A: Allocator> TrustedLen for Drain<'_, T, A> {}
46436 impl<T, A: Allocator> FusedIterator for Drain<'_, T, A> {}
46442 /// Another specialization trait for Vec::from_iter
46444 /// see [`SpecFromIter`](super::SpecFromIter) for details.
46449 impl<T, I> SpecFromIterNested<T, I> for Vec<T>
46472 // to spec_from for empty Vecs
46478 impl<T, I> SpecFromIterNested<T, I> for Vec<T>
46491 // reuse extend specialization for TrustedLen
46506 unsafe impl IsZero for $t {
46533 unsafe impl<T> IsZero for *const T {
46540 unsafe impl<T> IsZero for *mut T {
46551 // `Option<&mut T>` never implements `Clone`, so there's no need for an impl of
46554 unsafe impl<T: ?Sized> IsZero for Option<&T> {
46561 unsafe impl<T: ?Sized> IsZero for Option<Box<T>> {
46573 /// Specialization trait used for Vec::from_iter
46597 impl<T, I> SpecFromIter<T, I> for Vec<T>
46606 impl<T> SpecFromIter<T, IntoIter<T>> for Vec<T> {
46629 // to spec_from for empty Vecs
46635 impl<'a, T: 'a, I> SpecFromIter<&'a T, I> for Vec<T>
46649 impl<'a, T: 'a + Clone> SpecFromIter<&'a T, slice::Iter<'a, T>> for Vec<T> {
46656 // required for this method definition, is not available. Instead use the
46658 // NB see the slice::hack module in slice.rs for more information
46670 /// Specialization marker for collecting an iterator pipeline into a Vec while reusing the
46673 /// The SourceIter parent trait is necessary for the specializing function to access the allocation
46674 /// which is to be reused. But it is not sufficient for the specialization to be valid. See
46681 // on the adapter implementations (beyond `impl<I: Trait> Trait for Adapter<I>`) only depend on other
46685 impl<T> SourceIterMarker for T where T: SourceIter<Source: AsIntoIter> + InPlaceIterable {}
46687 impl<T, I> SpecFromIter<T, I> for Vec<T>
46764 /// collected. `end` is the last writable element of the allocation and used for bounds checks.
46768 impl<T, I> SpecInPlaceCollect<T, I> for I
46775 // - it vectorizes better for some iterator adapters
46786 impl<T, I> SpecInPlaceCollect<T, I> for I
46794 for i in 0..len {
46795 // Safety: InplaceIterable contract guarantees that for every element we read
46957 /// for x in &vec {
47045 /// when you just want to provide read access. The same goes for [`String`] and
47050 /// The capacity of a vector is the amount of space allocated for any future
47058 /// with space for 10 more elements. Pushing 10 or fewer elements onto the
47082 /// types inside a `Vec`, it will not allocate space for them. *Note that in this case
47086 /// and use it for something else (either to pass to unsafe code, or to build your
47118 /// stored on the stack for two reasons:
47120 /// * It would make it more difficult for unsafe code to correctly manipulate
47149 /// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
47156 /// removed data to be erased for security purposes. Even if you drop a `Vec`, its
47230 /// // The vector contains no items, even though it has capacity for more
47235 /// for i in 0..10 {
47274 /// alignments. The buffer was allocated with alignment 2 (for `u16`), but after
47306 /// for i in 0..len as isize {
47369 /// // The vector contains no items, even though it has capacity for more
47374 /// for i in 0..10 {
47412 /// alignments. The buffer was allocated with alignment 2 (for `u16`), but after
47452 /// for i in 0..len as isize {
47474 /// After calling this function, the caller is responsible for the
47511 /// After calling this function, the caller is responsible for the
47568 /// Reserves capacity for at least `additional` more elements to be inserted
47591 /// Reserves the minimum capacity for exactly `additional` more elements to
47617 /// Tries to reserve capacity for at least `additional` more elements to be inserted
47655 /// Tries to reserve the minimum capacity for exactly `additional`
47700 /// may still inform the vector that there is space for a few more elements.
47838 // implications in some cases. See #78884 for more.
47901 /// for i in 0..x.len() {
47930 /// // Allocate vector big enough for 4 elements.
47937 /// for i in 0..size {
47984 /// This method can be useful for situations in which the vector
47985 /// is serving as a buffer for other code, particularly over FFI:
47989 /// # // This is just a minimal skeleton for the doc example;
47990 /// # // don't use this as a starting point for a real library.
48123 // space for the new element
48240 impl<T, A: Allocator> Drop for BackshiftOnDrop<'_, T, A> {
48275 // We use copy for move, and never touch this element again.
48353 impl<'a, T, A: core::alloc::Allocator> Drop for FillGapOnDrop<'a, T, A> {
48442 // or if the length increment would overflow for zero-sized types.
48515 /// iterator **is not** dropped (with [`mem::forget`] for example), it is
48723 /// This function is mainly useful for data that lives for the remainder of
48760 /// // Allocate vector big enough for 10 elements.
48799 /// Note that this is a low-level API, which should be used with care for
48821 /// // Reserve additional space big enough for 10 elements.
48861 // - `ptr` is guaranteed to be valid for `len` elements
48955 // - `slice::range` guarantees that the given range is valid for indexing self
48969 impl<T: Clone> ExtendWith<T> for ExtendElement<T> {
48979 impl<T: Default> ExtendWith<T> for ExtendDefault {
48989 impl<T, F: FnMut() -> T> ExtendWith<T> for ExtendFunc<F> {
49011 for _ in 1..n {
49075 impl<T: Clone, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
49094 impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
49109 // - `count` is equal to the len of `source`, so source is valid for
49112 // is valid for `count` writes
49123 // Common trait implementations for Vec
49127 impl<T, A: Allocator> ops::Deref for Vec<T, A> {
49136 impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
49143 impl<T: Clone, A: Allocator + Clone> Clone for Vec<T, A> {
49151 // required for this method definition, is not available. Instead use the
49153 // NB see the slice::hack module in slice.rs for more information
49175 impl<T: Hash, A: Allocator> Hash for Vec<T, A> {
49187 impl<T, I: SliceIndex<[T]>, A: Allocator> Index<I> for Vec<T, A> {
49201 impl<T, I: SliceIndex<[T]>, A: Allocator> IndexMut<I> for Vec<T, A> {
49209 impl<T> FromIterator<T> for Vec<T> {
49217 impl<T, A: Allocator> IntoIterator for Vec<T, A> {
49229 /// for s in v.into_iter() {
49259 impl<'a, T, A: Allocator> IntoIterator for &'a Vec<T, A> {
49269 impl<'a, T, A: Allocator> IntoIterator for &'a mut Vec<T, A> {
49279 impl<T, A: Allocator> Extend<T> for Vec<T, A> {
49300 // This is the case for a general iterator.
49304 // for item in iterator {
49426 /// This implementation is specialized for slice iterators, where it uses [`copy_from_slice`] to
49431 impl<'a, T: Copy + 'a, A: Allocator + 'a> Extend<&'a T> for Vec<T, A> {
49449 impl<T: PartialOrd, A: Allocator> PartialOrd for Vec<T, A> {
49457 impl<T: Eq, A: Allocator> Eq for Vec<T, A> {}
49461 impl<T: Ord, A: Allocator> Ord for Vec<T, A> {
49469 unsafe impl<#[may_dangle] T, A: Allocator> Drop for Vec<T, A> {
49472 // use drop for [T]
49482 impl<T> Default for Vec<T> {
49490 impl<T: fmt::Debug, A: Allocator> fmt::Debug for Vec<T, A> {
49497 impl<T, A: Allocator> AsRef<Vec<T, A>> for Vec<T, A> {
49504 impl<T, A: Allocator> AsMut<Vec<T, A>> for Vec<T, A> {
49511 impl<T, A: Allocator> AsRef<[T]> for Vec<T, A> {
49518 impl<T, A: Allocator> AsMut<[T]> for Vec<T, A> {
49525 impl<T: Clone> From<&[T]> for Vec<T> {
49544 impl<T: Clone> From<&mut [T]> for Vec<T> {
49563 impl<T, const N: usize> From<[T; N]> for Vec<T> {
49582 impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
49608 impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
49626 impl<T, A: Allocator> From<Vec<T, A>> for Box<[T], A> {
49643 impl From<&str> for Vec<u8> {
49657 impl<T, A: Allocator, const N: usize> TryFrom<Vec<T, A>> for [T; N] {
49710 // pointer. This is a workaround for alias analysis issue #32155
49728 impl Drop for SetLenOnDrop<'_> {
49743 /// See its documentation for more.
49793 impl<T, F, A: Allocator> Iterator for DrainFilter<'_, T, F, A>
49831 impl<T, F, A: Allocator> Drop for DrainFilter<'_, T, F, A>
49843 impl<'a, 'b, T, F, A: Allocator> Drop for BackshiftOnDrop<'a, 'b, T, F, A>
49883 impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> {
49890 impl<'a, T: Clone> From<Vec<T>> for Cow<'a, [T]> {
49897 impl<'a, T: Clone> From<&'a Vec<T>> for Cow<'a, [T]> {
49904 impl<'a, T> FromIterator<T> for Cow<'a, [T]>
49920 impl<T, U, $($vars)*> PartialEq<$rhs> for $lhs
49961 /// A splicing iterator for `Vec`.
49964 /// See its documentation for more.
49985 impl<I: Iterator, A: Allocator> Iterator for Splice<'_, I, A> {
49998 impl<I: Iterator, A: Allocator> DoubleEndedIterator for Splice<'_, I, A> {
50005 impl<I: Iterator, A: Allocator> ExactSizeIterator for Splice<'_, I, A> {}
50008 impl<I: Iterator, A: Allocator> Drop for Splice<'_, I, A> {
50048 /// Private helper methods for `Splice::drop`
50062 for place in range_slice {
50073 /// Makes room for inserting more elements before the tail.
50091 // A helper struct for in-place iteration that drops the destination slice of iteration,
50104 impl<T> Drop for InPlaceDrop<T> {
50129 //! See the [module-level documentation](../index.html) for more.
50171 //! A pointer type for heap allocation.
50174 //! heap allocation in Rust. Boxes provide ownership for this allocation, and
50220 //! for a `Cons`. By introducing a [`Box<T>`], which has a defined size, we know how
50225 //! For non-zero-sized values, a [`Box`] will use the [`Global`] allocator for
50228 //! [`Layout`] used with the allocator is correct for the type. More precisely,
50235 //! For zero-sized values, the `Box` pointer still has to be [valid] for reads
50283 //! non-null pointers. Moreover, the destructor for `Box<T>` will attempt to
50285 //! is to only use `Box<T>` for pointers that originated from the global
50289 //! `Box<T>` types for functions that are defined in C but invoked
50329 /// A pointer type for heap allocation.
50331 /// See the [module-level documentation](../../std/boxed/index.html) for more.
50385 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
50464 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
50602 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
50635 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
50728 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
50781 /// See [`MaybeUninit::zeroed`][zeroed] for examples of correct and incorrect usage
50914 /// // the (uninitialized) previous contents of `ptr`, though for this
50968 /// // the (uninitialized) previous contents of `ptr`, though for this
50988 /// After calling this function, the caller is responsible for the
51002 /// for automatic cleanup:
51033 /// After calling this function, the caller is responsible for the
51047 /// for automatic cleanup:
51091 // raw pointer for the type system. Turning it directly into a raw pointer would not be
51115 /// This function is mainly useful for data that lives for the remainder of
51172 unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
51179 impl<T: Default> Default for Box<T> {
51180 /// Creates a `Box<T>`, with the `Default` value for T.
51187 impl<T> Default for Box<[T]> {
51194 impl Default for Box<str> {
51201 impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A> {
51250 impl Clone for Box<str> {
51259 impl<T: ?Sized + PartialEq, A: Allocator> PartialEq for Box<T, A> {
51270 impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for Box<T, A> {
51293 impl<T: ?Sized + Ord, A: Allocator> Ord for Box<T, A> {
51300 impl<T: ?Sized + Eq, A: Allocator> Eq for Box<T, A> {}
51303 impl<T: ?Sized + Hash, A: Allocator> Hash for Box<T, A> {
51310 impl<T: ?Sized + Hasher, A: Allocator> Hasher for Box<T, A> {
51356 impl<T> From<T> for Box<T> {
51375 impl<T: ?Sized, A: Allocator> From<Box<T, A>> for Pin<Box<T, A>>
51388 impl<T: Copy> From<&[T]> for Box<[T]> {
51413 impl<T: Copy> From<Cow<'_, [T]>> for Box<[T]> {
51424 impl From<&str> for Box<str> {
51442 impl From<Cow<'_, str>> for Box<str> {
51453 impl<A: Allocator> From<Box<str, A>> for Box<[u8], A> {
51478 impl<T, const N: usize> From<[T; N]> for Box<[T]> {
51494 impl<T, const N: usize> TryFrom<Box<[T]>> for Box<[T; N]> {
51604 impl<T: fmt::Display + ?Sized, A: Allocator> fmt::Display for Box<T, A> {
51611 impl<T: fmt::Debug + ?Sized, A: Allocator> fmt::Debug for Box<T, A> {
51618 impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
51628 impl<T: ?Sized, A: Allocator> Deref for Box<T, A> {
51637 impl<T: ?Sized, A: Allocator> DerefMut for Box<T, A> {
51644 impl<T: ?Sized, A: Allocator> Receiver for Box<T, A> {}
51647 impl<I: Iterator + ?Sized, A: Allocator> Iterator for Box<I, A> {
51668 impl<I: Iterator + ?Sized, A: Allocator> BoxIter for Box<I, A> {
51680 /// Specialization for sized `I`s that uses `I`s implementation of `last()`
51683 impl<I: Iterator, A: Allocator> BoxIter for Box<I, A> {
51690 impl<I: DoubleEndedIterator + ?Sized, A: Allocator> DoubleEndedIterator for Box<I, A> {
51699 impl<I: ExactSizeIterator + ?Sized, A: Allocator> ExactSizeIterator for Box<I, A> {
51709 impl<I: FusedIterator + ?Sized, A: Allocator> FusedIterator for Box<I, A> {}
51712 impl<Args, F: FnOnce<Args> + ?Sized, A: Allocator> FnOnce<Args> for Box<F, A> {
51721 impl<Args, F: FnMut<Args> + ?Sized, A: Allocator> FnMut<Args> for Box<F, A> {
51728 impl<Args, F: Fn<Args> + ?Sized, A: Allocator> Fn<Args> for Box<F, A> {
51735 impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}
51738 impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global> {}
51741 impl<I> FromIterator<I> for Box<[I]> {
51748 impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A> {
51764 impl<T: ?Sized, A: Allocator> borrow::Borrow<T> for Box<T, A> {
51771 impl<T: ?Sized, A: Allocator> borrow::BorrowMut<T> for Box<T, A> {
51778 impl<T: ?Sized, A: Allocator> AsRef<T> for Box<T, A> {
51785 impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
51798 * We chose this API instead of the alternative for a few reasons:
51802 * (Box<T> is the only pointer type in std for which this would be
51805 * Unpin because of trait objects, for which the structural auto
51814 impl<T: ?Sized, A: Allocator> Unpin for Box<T, A> where A: 'static {}
51817 impl<G: ?Sized + Generator<R> + Unpin, R, A: Allocator> Generator<R> for Box<G, A>
51830 impl<G: ?Sized + Generator<R>, R, A: Allocator> Generator<R> for Pin<Box<G, A>>
51843 impl<F: ?Sized + Future + Unpin, A: Allocator> Future for Box<F, A>
51855 impl<S: ?Sized + Stream + Unpin> Stream for Box<S> {
51888 unsafe impl Allocator for BoundedAlloc {
51945 //! Test for `boxed` mod.
52036 impl Foo for Bar {