Coverage Report

Created: 2026-02-14 07:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/smallvec-1.15.1/src/lib.rs
Line
Count
Source
1
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
2
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4
// option. This file may not be copied, modified, or distributed
5
// except according to those terms.
6
7
//! Small vectors in various sizes. These store a certain number of elements inline, and fall back
8
//! to the heap for larger allocations.  This can be a useful optimization for improving cache
9
//! locality and reducing allocator traffic for workloads that fit within the inline buffer.
10
//!
11
//! ## `no_std` support
12
//!
13
//! By default, `smallvec` does not depend on `std`.  However, the optional
14
//! `write` feature implements the `std::io::Write` trait for vectors of `u8`.
15
//! When this feature is enabled, `smallvec` depends on `std`.
16
//!
17
//! ## Optional features
18
//!
19
//! ### `serde`
20
//!
21
//! When this optional dependency is enabled, `SmallVec` implements the `serde::Serialize` and
22
//! `serde::Deserialize` traits.
23
//!
24
//! ### `write`
25
//!
26
//! When this feature is enabled, `SmallVec<[u8; _]>` implements the `std::io::Write` trait.
27
//! This feature is not compatible with `#![no_std]` programs.
28
//!
29
//! ### `union`
30
//!
31
//! **This feature requires Rust 1.49.**
32
//!
33
//! When the `union` feature is enabled `smallvec` will track its state (inline or spilled)
34
//! without the use of an enum tag, reducing the size of the `smallvec` by one machine word.
35
//! This means that there is potentially no space overhead compared to `Vec`.
36
//! Note that `smallvec` can still be larger than `Vec` if the inline buffer is larger than two
37
//! machine words.
38
//!
39
//! To use this feature add `features = ["union"]` in the `smallvec` section of Cargo.toml.
40
//! Note that this feature requires Rust 1.49.
41
//!
42
//! Tracking issue: [rust-lang/rust#55149](https://github.com/rust-lang/rust/issues/55149)
43
//!
44
//! ### `const_generics`
45
//!
46
//! **This feature requires Rust 1.51.**
47
//!
48
//! When this feature is enabled, `SmallVec` works with any arrays of any size, not just a fixed
49
//! list of sizes.
50
//!
51
//! ### `const_new`
52
//!
53
//! **This feature requires Rust 1.51.**
54
//!
55
//! This feature exposes the functions [`SmallVec::new_const`], [`SmallVec::from_const`], and [`smallvec_inline`] which enables the `SmallVec` to be initialized from a const context.
56
//! For details, see the
57
//! [Rust Reference](https://doc.rust-lang.org/reference/const_eval.html#const-functions).
58
//!
59
//! ### `drain_filter`
60
//!
61
//! **This feature is unstable.** It may change to match the unstable `drain_filter` method in libstd.
62
//!
63
//! Enables the `drain_filter` method, which produces an iterator that calls a user-provided
64
//! closure to determine which elements of the vector to remove and yield from the iterator.
65
//!
66
//! ### `drain_keep_rest`
67
//!
68
//! **This feature is unstable.** It may change to match the unstable `drain_keep_rest` method in libstd.
69
//!
70
//! Enables the `DrainFilter::keep_rest` method.
71
//!
72
//! ### `specialization`
73
//!
74
//! **This feature is unstable and requires a nightly build of the Rust toolchain.**
75
//!
76
//! When this feature is enabled, `SmallVec::from(slice)` has improved performance for slices
77
//! of `Copy` types.  (Without this feature, you can use `SmallVec::from_slice` to get optimal
78
//! performance for `Copy` types.)
79
//!
80
//! Tracking issue: [rust-lang/rust#31844](https://github.com/rust-lang/rust/issues/31844)
81
//!
82
//! ### `may_dangle`
83
//!
84
//! **This feature is unstable and requires a nightly build of the Rust toolchain.**
85
//!
86
//! This feature makes the Rust compiler less strict about use of vectors that contain borrowed
87
//! references. For details, see the
88
//! [Rustonomicon](https://doc.rust-lang.org/1.42.0/nomicon/dropck.html#an-escape-hatch).
89
//!
90
//! Tracking issue: [rust-lang/rust#34761](https://github.com/rust-lang/rust/issues/34761)
91
92
#![no_std]
93
#![cfg_attr(docsrs, feature(doc_cfg))]
94
#![cfg_attr(feature = "specialization", allow(incomplete_features))]
95
#![cfg_attr(feature = "specialization", feature(specialization))]
96
#![cfg_attr(feature = "may_dangle", feature(dropck_eyepatch))]
97
#![cfg_attr(
98
    feature = "debugger_visualizer",
99
    feature(debugger_visualizer),
100
    debugger_visualizer(natvis_file = "../debug_metadata/smallvec.natvis")
101
)]
102
#![deny(missing_docs)]
103
104
#[doc(hidden)]
105
pub extern crate alloc;
106
107
#[cfg(any(test, feature = "write"))]
108
extern crate std;
109
110
#[cfg(test)]
111
mod tests;
112
113
#[allow(deprecated)]
114
use alloc::alloc::{Layout, LayoutErr};
115
use alloc::boxed::Box;
116
use alloc::{vec, vec::Vec};
117
use core::borrow::{Borrow, BorrowMut};
118
use core::cmp;
119
use core::fmt;
120
use core::hash::{Hash, Hasher};
121
use core::hint::unreachable_unchecked;
122
use core::iter::{repeat, FromIterator, FusedIterator, IntoIterator};
123
use core::mem;
124
use core::mem::MaybeUninit;
125
use core::ops::{self, Range, RangeBounds};
126
use core::ptr::{self, NonNull};
127
use core::slice::{self, SliceIndex};
128
129
#[cfg(feature = "malloc_size_of")]
130
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
131
132
#[cfg(feature = "serde")]
133
use serde::{
134
    de::{Deserialize, Deserializer, SeqAccess, Visitor},
135
    ser::{Serialize, SerializeSeq, Serializer},
136
};
137
138
#[cfg(feature = "serde")]
139
use core::marker::PhantomData;
140
141
#[cfg(feature = "write")]
142
use std::io;
143
144
#[cfg(feature = "drain_keep_rest")]
145
use core::mem::ManuallyDrop;
146
147
/// Creates a [`SmallVec`] containing the arguments.
148
///
149
/// `smallvec!` allows `SmallVec`s to be defined with the same syntax as array expressions.
150
/// There are two forms of this macro:
151
///
152
/// - Create a [`SmallVec`] containing a given list of elements:
153
///
154
/// ```
155
/// # use smallvec::{smallvec, SmallVec};
156
/// # fn main() {
157
/// let v: SmallVec<[_; 128]> = smallvec![1, 2, 3];
158
/// assert_eq!(v[0], 1);
159
/// assert_eq!(v[1], 2);
160
/// assert_eq!(v[2], 3);
161
/// # }
162
/// ```
163
///
164
/// - Create a [`SmallVec`] from a given element and size:
165
///
166
/// ```
167
/// # use smallvec::{smallvec, SmallVec};
168
/// # fn main() {
169
/// let v: SmallVec<[_; 0x8000]> = smallvec![1; 3];
170
/// assert_eq!(v, SmallVec::from_buf([1, 1, 1]));
171
/// # }
172
/// ```
173
///
174
/// Note that unlike array expressions this syntax supports all elements
175
/// which implement [`Clone`] and the number of elements doesn't have to be
176
/// a constant.
177
///
178
/// This will use `clone` to duplicate an expression, so one should be careful
179
/// using this with types having a nonstandard `Clone` implementation. For
180
/// example, `smallvec![Rc::new(1); 5]` will create a vector of five references
181
/// to the same boxed integer value, not five references pointing to independently
182
/// boxed integers.
183
#[macro_export]
184
macro_rules! smallvec {
185
    // count helper: transform any expression into 1
186
    (@one $x:expr) => (1usize);
187
    () => (
188
        $crate::SmallVec::new()
189
    );
190
    ($elem:expr; $n:expr) => ({
191
        $crate::SmallVec::from_elem($elem, $n)
192
    });
193
    ($($x:expr),+$(,)?) => ({
194
        let count = 0usize $(+ $crate::smallvec!(@one $x))+;
195
        let mut vec = $crate::SmallVec::new();
196
        if count <= vec.inline_size() {
197
            $(vec.push($x);)*
198
            vec
199
        } else {
200
            $crate::SmallVec::from_vec($crate::alloc::vec![$($x,)+])
201
        }
202
    });
203
}
204
205
/// Creates an inline [`SmallVec`] containing the arguments. This macro is enabled by the feature `const_new`.
206
///
207
/// `smallvec_inline!` allows `SmallVec`s to be defined with the same syntax as array expressions in `const` contexts.
208
/// The inline storage `A` will always be an array of the size specified by the arguments.
209
/// There are two forms of this macro:
210
///
211
/// - Create a [`SmallVec`] containing a given list of elements:
212
///
213
/// ```
214
/// # use smallvec::{smallvec_inline, SmallVec};
215
/// # fn main() {
216
/// const V: SmallVec<[i32; 3]> = smallvec_inline![1, 2, 3];
217
/// assert_eq!(V[0], 1);
218
/// assert_eq!(V[1], 2);
219
/// assert_eq!(V[2], 3);
220
/// # }
221
/// ```
222
///
223
/// - Create a [`SmallVec`] from a given element and size:
224
///
225
/// ```
226
/// # use smallvec::{smallvec_inline, SmallVec};
227
/// # fn main() {
228
/// const V: SmallVec<[i32; 3]> = smallvec_inline![1; 3];
229
/// assert_eq!(V, SmallVec::from_buf([1, 1, 1]));
230
/// # }
231
/// ```
232
///
233
/// Note that the behavior mimics that of array expressions, in contrast to [`smallvec`].
234
#[cfg(feature = "const_new")]
235
#[cfg_attr(docsrs, doc(cfg(feature = "const_new")))]
236
#[macro_export]
237
macro_rules! smallvec_inline {
238
    // count helper: transform any expression into 1
239
    (@one $x:expr) => (1usize);
240
    ($elem:expr; $n:expr) => ({
241
        $crate::SmallVec::<[_; $n]>::from_const([$elem; $n])
242
    });
243
    ($($x:expr),+ $(,)?) => ({
244
        const N: usize = 0usize $(+ $crate::smallvec_inline!(@one $x))*;
245
        $crate::SmallVec::<[_; N]>::from_const([$($x,)*])
246
    });
247
}
248
249
/// `panic!()` in debug builds, optimization hint in release.
250
#[cfg(not(feature = "union"))]
251
macro_rules! debug_unreachable {
252
    () => {
253
        debug_unreachable!("entered unreachable code")
254
    };
255
    ($e:expr) => {
256
        if cfg!(debug_assertions) {
257
            panic!($e);
258
        } else {
259
            unreachable_unchecked();
260
        }
261
    };
262
}
263
264
/// Trait to be implemented by a collection that can be extended from a slice
265
///
266
/// ## Example
267
///
268
/// ```rust
269
/// use smallvec::{ExtendFromSlice, SmallVec};
270
///
271
/// fn initialize<V: ExtendFromSlice<u8>>(v: &mut V) {
272
///     v.extend_from_slice(b"Test!");
273
/// }
274
///
275
/// let mut vec = Vec::new();
276
/// initialize(&mut vec);
277
/// assert_eq!(&vec, b"Test!");
278
///
279
/// let mut small_vec = SmallVec::<[u8; 8]>::new();
280
/// initialize(&mut small_vec);
281
/// assert_eq!(&small_vec as &[_], b"Test!");
282
/// ```
283
#[doc(hidden)]
284
#[deprecated]
285
pub trait ExtendFromSlice<T> {
286
    /// Extends a collection from a slice of its element type
287
    fn extend_from_slice(&mut self, other: &[T]);
288
}
289
290
#[allow(deprecated)]
291
impl<T: Clone> ExtendFromSlice<T> for Vec<T> {
292
    fn extend_from_slice(&mut self, other: &[T]) {
293
        Vec::extend_from_slice(self, other)
294
    }
295
}
296
297
/// Error type for APIs with fallible heap allocation
298
#[derive(Debug)]
299
pub enum CollectionAllocErr {
300
    /// Overflow `usize::MAX` or other error during size computation
301
    CapacityOverflow,
302
    /// The allocator return an error
303
    AllocErr {
304
        /// The layout that was passed to the allocator
305
        layout: Layout,
306
    },
307
}
308
309
impl fmt::Display for CollectionAllocErr {
310
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
311
        write!(f, "Allocation error: {:?}", self)
312
    }
313
}
314
315
#[allow(deprecated)]
316
impl From<LayoutErr> for CollectionAllocErr {
317
    fn from(_: LayoutErr) -> Self {
318
        CollectionAllocErr::CapacityOverflow
319
    }
320
}
321
322
3.58M
fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T {
323
0
    match result {
324
3.58M
        Ok(x) => x,
325
0
        Err(CollectionAllocErr::CapacityOverflow) => panic!("capacity overflow"),
326
0
        Err(CollectionAllocErr::AllocErr { layout }) => alloc::alloc::handle_alloc_error(layout),
327
    }
328
3.58M
}
smallvec::infallible::<()>
Line
Count
Source
322
6.14k
fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T {
323
0
    match result {
324
6.14k
        Ok(x) => x,
325
0
        Err(CollectionAllocErr::CapacityOverflow) => panic!("capacity overflow"),
326
0
        Err(CollectionAllocErr::AllocErr { layout }) => alloc::alloc::handle_alloc_error(layout),
327
    }
328
6.14k
}
smallvec::infallible::<()>
Line
Count
Source
322
71.8k
fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T {
323
0
    match result {
324
71.8k
        Ok(x) => x,
325
0
        Err(CollectionAllocErr::CapacityOverflow) => panic!("capacity overflow"),
326
0
        Err(CollectionAllocErr::AllocErr { layout }) => alloc::alloc::handle_alloc_error(layout),
327
    }
328
71.8k
}
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
smallvec::infallible::<()>
Line
Count
Source
322
860
fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T {
323
0
    match result {
324
860
        Ok(x) => x,
325
0
        Err(CollectionAllocErr::CapacityOverflow) => panic!("capacity overflow"),
326
0
        Err(CollectionAllocErr::AllocErr { layout }) => alloc::alloc::handle_alloc_error(layout),
327
    }
328
860
}
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
smallvec::infallible::<()>
Line
Count
Source
322
3.50M
fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T {
323
0
    match result {
324
3.50M
        Ok(x) => x,
325
0
        Err(CollectionAllocErr::CapacityOverflow) => panic!("capacity overflow"),
326
0
        Err(CollectionAllocErr::AllocErr { layout }) => alloc::alloc::handle_alloc_error(layout),
327
    }
328
3.50M
}
Unexecuted instantiation: smallvec::infallible::<()>
Unexecuted instantiation: smallvec::infallible::<()>
329
330
/// FIXME: use `Layout::array` when we require a Rust version where it’s stable
331
/// <https://github.com/rust-lang/rust/issues/55724>
332
202k
fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> {
333
202k
    let size = mem::size_of::<T>()
334
202k
        .checked_mul(n)
335
202k
        .ok_or(CollectionAllocErr::CapacityOverflow)?;
336
202k
    let align = mem::align_of::<T>();
337
202k
    Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow)
338
202k
}
smallvec::layout_array::<gix_config::parse::Event>
Line
Count
Source
332
242
fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> {
333
242
    let size = mem::size_of::<T>()
334
242
        .checked_mul(n)
335
242
        .ok_or(CollectionAllocErr::CapacityOverflow)?;
336
242
    let align = mem::align_of::<T>();
337
242
    Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow)
338
242
}
smallvec::layout_array::<gix_config::parse::Event>
Line
Count
Source
332
1.15k
fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> {
333
1.15k
    let size = mem::size_of::<T>()
334
1.15k
        .checked_mul(n)
335
1.15k
        .ok_or(CollectionAllocErr::CapacityOverflow)?;
336
1.15k
    let align = mem::align_of::<T>();
337
1.15k
    Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow)
338
1.15k
}
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::layout_array::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<parking_lot_core::thread_parker::imp::UnparkHandle>
Unexecuted instantiation: smallvec::layout_array::<(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>)>
Unexecuted instantiation: smallvec::layout_array::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::layout_array::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::layout_array::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<u8>
smallvec::layout_array::<u8>
Line
Count
Source
332
201
fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> {
333
201
    let size = mem::size_of::<T>()
334
201
        .checked_mul(n)
335
201
        .ok_or(CollectionAllocErr::CapacityOverflow)?;
336
201
    let align = mem::align_of::<T>();
337
201
    Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow)
338
201
}
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<(gix_hash::object_id::ObjectId, i64)>
Unexecuted instantiation: smallvec::layout_array::<parking_lot_core::thread_parker::imp::UnparkHandle>
Unexecuted instantiation: smallvec::layout_array::<gix_attributes::search::Match>
Unexecuted instantiation: smallvec::layout_array::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::layout_array::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::layout_array::<u8>
Unexecuted instantiation: smallvec::layout_array::<gix_attributes::search::TrackedAssignment>
Unexecuted instantiation: smallvec::layout_array::<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>
Unexecuted instantiation: smallvec::layout_array::<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>
smallvec::layout_array::<gix_attributes::search::TrackedAssignment>
Line
Count
Source
332
195k
fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> {
333
195k
    let size = mem::size_of::<T>()
334
195k
        .checked_mul(n)
335
195k
        .ok_or(CollectionAllocErr::CapacityOverflow)?;
336
195k
    let align = mem::align_of::<T>();
337
195k
    Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow)
338
195k
}
Unexecuted instantiation: smallvec::layout_array::<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>
smallvec::layout_array::<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>
Line
Count
Source
332
4.90k
fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> {
333
4.90k
    let size = mem::size_of::<T>()
334
4.90k
        .checked_mul(n)
335
4.90k
        .ok_or(CollectionAllocErr::CapacityOverflow)?;
336
4.90k
    let align = mem::align_of::<T>();
337
4.90k
    Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow)
338
4.90k
}
Unexecuted instantiation: smallvec::layout_array::<core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>>
Unexecuted instantiation: smallvec::layout_array::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::layout_array::<gix_attributes::search::TrackedAssignment>
Unexecuted instantiation: smallvec::layout_array::<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>
Unexecuted instantiation: smallvec::layout_array::<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>
339
340
0
unsafe fn deallocate<T>(ptr: NonNull<T>, capacity: usize) {
341
    // This unwrap should succeed since the same did when allocating.
342
0
    let layout = layout_array::<T>(capacity).unwrap();
343
0
    alloc::alloc::dealloc(ptr.as_ptr() as *mut u8, layout)
344
0
}
Unexecuted instantiation: smallvec::deallocate::<gix_config::parse::Event>
Unexecuted instantiation: smallvec::deallocate::<gix_config::parse::Event>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::deallocate::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<parking_lot_core::thread_parker::imp::UnparkHandle>
Unexecuted instantiation: smallvec::deallocate::<(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>)>
Unexecuted instantiation: smallvec::deallocate::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::deallocate::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::deallocate::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<(gix_hash::object_id::ObjectId, i64)>
Unexecuted instantiation: smallvec::deallocate::<parking_lot_core::thread_parker::imp::UnparkHandle>
Unexecuted instantiation: smallvec::deallocate::<gix_attributes::search::Match>
Unexecuted instantiation: smallvec::deallocate::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::deallocate::<&bstr::bstr::BStr>
Unexecuted instantiation: smallvec::deallocate::<u8>
Unexecuted instantiation: smallvec::deallocate::<gix_attributes::search::TrackedAssignment>
Unexecuted instantiation: smallvec::deallocate::<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>
Unexecuted instantiation: smallvec::deallocate::<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>
Unexecuted instantiation: smallvec::deallocate::<gix_attributes::search::TrackedAssignment>
Unexecuted instantiation: smallvec::deallocate::<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>
Unexecuted instantiation: smallvec::deallocate::<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>
Unexecuted instantiation: smallvec::deallocate::<core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>>
Unexecuted instantiation: smallvec::deallocate::<gix_hash::object_id::ObjectId>
Unexecuted instantiation: smallvec::deallocate::<gix_attributes::search::TrackedAssignment>
Unexecuted instantiation: smallvec::deallocate::<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>
Unexecuted instantiation: smallvec::deallocate::<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>
345
346
/// An iterator that removes the items from a `SmallVec` and yields them by value.
347
///
348
/// Returned from [`SmallVec::drain`][1].
349
///
350
/// [1]: struct.SmallVec.html#method.drain
351
pub struct Drain<'a, T: 'a + Array> {
352
    tail_start: usize,
353
    tail_len: usize,
354
    iter: slice::Iter<'a, T::Item>,
355
    vec: NonNull<SmallVec<T>>,
356
}
357
358
impl<'a, T: 'a + Array> fmt::Debug for Drain<'a, T>
359
where
360
    T::Item: fmt::Debug,
361
{
362
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
363
        f.debug_tuple("Drain").field(&self.iter.as_slice()).finish()
364
    }
365
}
366
367
unsafe impl<'a, T: Sync + Array> Sync for Drain<'a, T> {}
368
unsafe impl<'a, T: Send + Array> Send for Drain<'a, T> {}
369
370
impl<'a, T: 'a + Array> Iterator for Drain<'a, T> {
371
    type Item = T::Item;
372
373
    #[inline]
374
    fn next(&mut self) -> Option<T::Item> {
375
        self.iter
376
            .next()
377
            .map(|reference| unsafe { ptr::read(reference) })
378
    }
379
380
    #[inline]
381
    fn size_hint(&self) -> (usize, Option<usize>) {
382
        self.iter.size_hint()
383
    }
384
}
385
386
impl<'a, T: 'a + Array> DoubleEndedIterator for Drain<'a, T> {
387
    #[inline]
388
    fn next_back(&mut self) -> Option<T::Item> {
389
        self.iter
390
            .next_back()
391
            .map(|reference| unsafe { ptr::read(reference) })
392
    }
393
}
394
395
impl<'a, T: Array> ExactSizeIterator for Drain<'a, T> {
396
    #[inline]
397
    fn len(&self) -> usize {
398
        self.iter.len()
399
    }
400
}
401
402
impl<'a, T: Array> FusedIterator for Drain<'a, T> {}
403
404
impl<'a, T: 'a + Array> Drop for Drain<'a, T> {
405
    fn drop(&mut self) {
406
        self.for_each(drop);
407
408
        if self.tail_len > 0 {
409
            unsafe {
410
                let source_vec = self.vec.as_mut();
411
412
                // memmove back untouched tail, update to new length
413
                let start = source_vec.len();
414
                let tail = self.tail_start;
415
                if tail != start {
416
                    // as_mut_ptr creates a &mut, invalidating other pointers.
417
                    // This pattern avoids calling it with a pointer already present.
418
                    let ptr = source_vec.as_mut_ptr();
419
                    let src = ptr.add(tail);
420
                    let dst = ptr.add(start);
421
                    ptr::copy(src, dst, self.tail_len);
422
                }
423
                source_vec.set_len(start + self.tail_len);
424
            }
425
        }
426
    }
427
}
428
429
#[cfg(feature = "drain_filter")]
430
/// An iterator which uses a closure to determine if an element should be removed.
431
///
432
/// Returned from [`SmallVec::drain_filter`][1].
433
///
434
/// [1]: struct.SmallVec.html#method.drain_filter
435
pub struct DrainFilter<'a, T, F>
436
where
437
    F: FnMut(&mut T::Item) -> bool,
438
    T: Array,
439
{
440
    vec: &'a mut SmallVec<T>,
441
    /// The index of the item that will be inspected by the next call to `next`.
442
    idx: usize,
443
    /// The number of items that have been drained (removed) thus far.
444
    del: usize,
445
    /// The original length of `vec` prior to draining.
446
    old_len: usize,
447
    /// The filter test predicate.
448
    pred: F,
449
    /// A flag that indicates a panic has occurred in the filter test predicate.
450
    /// This is used as a hint in the drop implementation to prevent consumption
451
    /// of the remainder of the `DrainFilter`. Any unprocessed items will be
452
    /// backshifted in the `vec`, but no further items will be dropped or
453
    /// tested by the filter predicate.
454
    panic_flag: bool,
455
}
456
457
#[cfg(feature = "drain_filter")]
458
impl <T, F> fmt::Debug for DrainFilter<'_, T, F>
459
where
460
    F: FnMut(&mut T::Item) -> bool,
461
    T: Array,
462
    T::Item: fmt::Debug,
463
{
464
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
465
        f.debug_tuple("DrainFilter").field(&self.vec.as_slice()).finish()
466
    }
467
}
468
469
#[cfg(feature = "drain_filter")]
470
impl <T, F> Iterator for DrainFilter<'_, T, F>
471
where
472
    F: FnMut(&mut T::Item) -> bool,
473
    T: Array,
474
{
475
    type Item = T::Item;
476
477
    fn next(&mut self) -> Option<T::Item>
478
    {
479
        unsafe {
480
            while self.idx < self.old_len {
481
                let i = self.idx;
482
                let v = slice::from_raw_parts_mut(self.vec.as_mut_ptr(), self.old_len);
483
                self.panic_flag = true;
484
                let drained = (self.pred)(&mut v[i]);
485
                self.panic_flag = false;
486
                // Update the index *after* the predicate is called. If the index
487
                // is updated prior and the predicate panics, the element at this
488
                // index would be leaked.
489
                self.idx += 1;
490
                if drained {
491
                    self.del += 1;
492
                    return Some(ptr::read(&v[i]));
493
                } else if self.del > 0 {
494
                    let del = self.del;
495
                    let src: *const Self::Item = &v[i];
496
                    let dst: *mut Self::Item = &mut v[i - del];
497
                    ptr::copy_nonoverlapping(src, dst, 1);
498
                }
499
            }
500
            None
501
        }
502
    }
503
504
    fn size_hint(&self) -> (usize, Option<usize>) {
505
        (0, Some(self.old_len - self.idx))
506
    }
507
}
508
509
#[cfg(feature = "drain_filter")]
510
impl <T, F> Drop for DrainFilter<'_, T, F>
511
where
512
    F: FnMut(&mut T::Item) -> bool,
513
    T: Array,
514
{
515
    fn drop(&mut self) {
516
        struct BackshiftOnDrop<'a, 'b, T, F>
517
        where
518
            F: FnMut(&mut T::Item) -> bool,
519
            T: Array
520
        {
521
            drain: &'b mut DrainFilter<'a, T, F>,
522
        }
523
524
        impl<'a, 'b, T, F> Drop for BackshiftOnDrop<'a, 'b, T, F>
525
        where
526
            F: FnMut(&mut T::Item) -> bool,
527
            T: Array
528
        {
529
            fn drop(&mut self) {
530
                unsafe {
531
                    if self.drain.idx < self.drain.old_len && self.drain.del > 0 {
532
                        // This is a pretty messed up state, and there isn't really an
533
                        // obviously right thing to do. We don't want to keep trying
534
                        // to execute `pred`, so we just backshift all the unprocessed
535
                        // elements and tell the vec that they still exist. The backshift
536
                        // is required to prevent a double-drop of the last successfully
537
                        // drained item prior to a panic in the predicate.
538
                        let ptr = self.drain.vec.as_mut_ptr();
539
                        let src = ptr.add(self.drain.idx);
540
                        let dst = src.sub(self.drain.del);
541
                        let tail_len = self.drain.old_len - self.drain.idx;
542
                        src.copy_to(dst, tail_len);
543
                    }
544
                    self.drain.vec.set_len(self.drain.old_len - self.drain.del);
545
                }
546
            }
547
        }
548
549
        let backshift = BackshiftOnDrop { drain: self };
550
551
        // Attempt to consume any remaining elements if the filter predicate
552
        // has not yet panicked. We'll backshift any remaining elements
553
        // whether we've already panicked or if the consumption here panics.
554
        if !backshift.drain.panic_flag {
555
            backshift.drain.for_each(drop);
556
        }
557
    }
558
}
559
560
#[cfg(feature = "drain_keep_rest")]
561
impl <T, F> DrainFilter<'_, T, F>
562
where
563
    F: FnMut(&mut T::Item) -> bool,
564
    T: Array
565
{
566
    /// Keep unyielded elements in the source `Vec`.
567
    ///
568
    /// # Examples
569
    ///
570
    /// ```
571
    /// # use smallvec::{smallvec, SmallVec};
572
    ///
573
    /// let mut vec: SmallVec<[char; 2]> = smallvec!['a', 'b', 'c'];
574
    /// let mut drain = vec.drain_filter(|_| true);
575
    ///
576
    /// assert_eq!(drain.next().unwrap(), 'a');
577
    ///
578
    /// // This call keeps 'b' and 'c' in the vec.
579
    /// drain.keep_rest();
580
    ///
581
    /// // If we wouldn't call `keep_rest()`,
582
    /// // `vec` would be empty.
583
    /// assert_eq!(vec, SmallVec::<[char; 2]>::from_slice(&['b', 'c']));
584
    /// ```
585
    pub fn keep_rest(self)
586
    {
587
        // At this moment layout looks like this:
588
        //
589
        //  _____________________/-- old_len
590
        // /                     \
591
        // [kept] [yielded] [tail]
592
        //        \_______/ ^-- idx
593
        //                \-- del
594
        //
595
        // Normally `Drop` impl would drop [tail] (via .for_each(drop), ie still calling `pred`)
596
        //
597
        // 1. Move [tail] after [kept]
598
        // 2. Update length of the original vec to `old_len - del`
599
        //    a. In case of ZST, this is the only thing we want to do
600
        // 3. Do *not* drop self, as everything is put in a consistent state already, there is nothing to do
601
        let mut this = ManuallyDrop::new(self);
602
603
        unsafe {
604
            // ZSTs have no identity, so we don't need to move them around.
605
            let needs_move = mem::size_of::<T>() != 0;
606
607
            if needs_move && this.idx < this.old_len && this.del > 0 {
608
                let ptr = this.vec.as_mut_ptr();
609
                let src = ptr.add(this.idx);
610
                let dst = src.sub(this.del);
611
                let tail_len = this.old_len - this.idx;
612
                src.copy_to(dst, tail_len);
613
            }
614
615
            let new_len = this.old_len - this.del;
616
            this.vec.set_len(new_len);
617
        }
618
    }
619
}
620
621
#[cfg(feature = "union")]
622
union SmallVecData<A: Array> {
623
    inline: core::mem::ManuallyDrop<MaybeUninit<A>>,
624
    heap: (NonNull<A::Item>, usize),
625
}
626
627
#[cfg(all(feature = "union", feature = "const_new"))]
628
impl<T, const N: usize> SmallVecData<[T; N]> {
629
    #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))]
630
    #[inline]
631
    const fn from_const(inline: MaybeUninit<[T; N]>) -> Self {
632
        SmallVecData {
633
            inline: core::mem::ManuallyDrop::new(inline),
634
        }
635
    }
636
}
637
638
#[cfg(feature = "union")]
639
impl<A: Array> SmallVecData<A> {
640
    #[inline]
641
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
642
        ConstNonNull::new(self.inline.as_ptr() as *const A::Item).unwrap()
643
    }
644
    #[inline]
645
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
646
        NonNull::new(self.inline.as_mut_ptr() as *mut A::Item).unwrap()
647
    }
648
    #[inline]
649
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
650
        SmallVecData {
651
            inline: core::mem::ManuallyDrop::new(inline),
652
        }
653
    }
654
    #[inline]
655
    unsafe fn into_inline(self) -> MaybeUninit<A> {
656
        core::mem::ManuallyDrop::into_inner(self.inline)
657
    }
658
    #[inline]
659
    unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) {
660
        (ConstNonNull(self.heap.0), self.heap.1)
661
    }
662
    #[inline]
663
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
664
        let h = &mut self.heap;
665
        (h.0, &mut h.1)
666
    }
667
    #[inline]
668
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
669
        SmallVecData { heap: (ptr, len) }
670
    }
671
}
672
673
#[cfg(not(feature = "union"))]
674
enum SmallVecData<A: Array> {
675
    Inline(MaybeUninit<A>),
676
    // Using NonNull and NonZero here allows to reduce size of `SmallVec`.
677
    Heap {
678
        // Since we never allocate on heap
679
        // unless our capacity is bigger than inline capacity
680
        // heap capacity cannot be less than 1.
681
        // Therefore, pointer cannot be null too.
682
        ptr: NonNull<A::Item>,
683
        len: usize,
684
    },
685
}
686
687
#[cfg(all(not(feature = "union"), feature = "const_new"))]
688
impl<T, const N: usize> SmallVecData<[T; N]> {
689
    #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))]
690
    #[inline]
691
    const fn from_const(inline: MaybeUninit<[T; N]>) -> Self {
692
        SmallVecData::Inline(inline)
693
    }
694
}
695
696
#[cfg(not(feature = "union"))]
697
impl<A: Array> SmallVecData<A> {
698
    #[inline]
699
4.56M
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
4.56M
        match self {
701
4.56M
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
4.56M
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline
Line
Count
Source
699
5.90k
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
5.90k
        match self {
701
5.90k
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
5.90k
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline
Line
Count
Source
699
84.8k
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
84.8k
        match self {
701
84.8k
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
84.8k
    }
<smallvec::SmallVecData<[u8; 2]>>::inline
Line
Count
Source
699
65.8k
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
65.8k
        match self {
701
65.8k
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
65.8k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline
<smallvec::SmallVecData<[u8; 256]>>::inline
Line
Count
Source
699
916
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
916
        match self {
701
916
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
916
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 23]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::Match; 6]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline
Line
Count
Source
699
4.29M
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
4.29M
        match self {
701
4.29M
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
4.29M
    }
<smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline
Line
Count
Source
699
114k
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
114k
        match self {
701
114k
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
114k
    }
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline
Line
Count
Source
699
2.35k
    unsafe fn inline(&self) -> ConstNonNull<A::Item> {
700
2.35k
        match self {
701
2.35k
            SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(),
702
0
            _ => debug_unreachable!(),
703
        }
704
2.35k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline
705
    #[inline]
706
13.7M
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
13.7M
        match self {
708
13.7M
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
13.7M
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline_mut
Line
Count
Source
706
36.5k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
36.5k
        match self {
708
36.5k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
36.5k
    }
<smallvec::SmallVecData<[u8; 2]>>::inline_mut
Line
Count
Source
706
44.7k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
44.7k
        match self {
708
44.7k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
44.7k
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline_mut
Line
Count
Source
706
74.7k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
74.7k
        match self {
708
74.7k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
74.7k
    }
<smallvec::SmallVecData<[u8; 2]>>::inline_mut
Line
Count
Source
706
107k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
107k
        match self {
708
107k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
107k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::inline_mut
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline_mut
Line
Count
Source
706
6.53k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
6.53k
        match self {
708
6.53k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
6.53k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut
<smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut
Line
Count
Source
706
187
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
187
        match self {
708
187
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
187
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
<smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut
Line
Count
Source
706
187
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
187
        match self {
708
187
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
187
    }
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
<smallvec::SmallVecData<[u8; 256]>>::inline_mut
Line
Count
Source
706
1.77k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
1.77k
        match self {
708
1.77k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
1.77k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 23]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::Match; 6]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Line
Count
Source
706
4.00M
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
4.00M
        match self {
708
4.00M
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
4.00M
    }
<smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Line
Count
Source
706
7.71k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
7.71k
        match self {
708
7.71k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
7.71k
    }
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
Line
Count
Source
706
6.93k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
6.93k
        match self {
708
6.93k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
6.93k
    }
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Line
Count
Source
706
9.38M
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
9.38M
        match self {
708
9.38M
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
9.38M
    }
<smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Line
Count
Source
706
5.26k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
5.26k
        match self {
708
5.26k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
5.26k
    }
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
Line
Count
Source
706
32.2k
    unsafe fn inline_mut(&mut self) -> NonNull<A::Item> {
707
32.2k
        match self {
708
32.2k
            SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(),
709
0
            _ => debug_unreachable!(),
710
        }
711
32.2k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut
712
    #[inline]
713
4.22M
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
4.22M
        SmallVecData::Inline(inline)
715
4.22M
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::from_inline
Line
Count
Source
713
18.2k
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
18.2k
        SmallVecData::Inline(inline)
715
18.2k
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::from_inline
Line
Count
Source
713
45.4k
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
45.4k
        SmallVecData::Inline(inline)
715
45.4k
    }
<smallvec::SmallVecData<[u8; 2]>>::from_inline
Line
Count
Source
713
50.8k
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
50.8k
        SmallVecData::Inline(inline)
715
50.8k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_inline
<smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_inline
Line
Count
Source
713
187
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
187
        SmallVecData::Inline(inline)
715
187
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
<smallvec::SmallVecData<[u8; 256]>>::from_inline
Line
Count
Source
713
430
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
430
        SmallVecData::Inline(inline)
715
430
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 23]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::Match; 6]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
<smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Line
Count
Source
713
7.71k
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
7.71k
        SmallVecData::Inline(inline)
715
7.71k
    }
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
Line
Count
Source
713
7.71k
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
7.71k
        SmallVecData::Inline(inline)
715
7.71k
    }
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::from_inline
Line
Count
Source
713
4.09M
    fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> {
714
4.09M
        SmallVecData::Inline(inline)
715
4.09M
    }
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_inline
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_inline
716
    #[inline]
717
    unsafe fn into_inline(self) -> MaybeUninit<A> {
718
        match self {
719
            SmallVecData::Inline(a) => a,
720
            _ => debug_unreachable!(),
721
        }
722
    }
723
    #[inline]
724
7.80M
    unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) {
725
7.80M
        match self {
726
7.80M
            SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len),
727
0
            _ => debug_unreachable!(),
728
        }
729
7.80M
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap
Line
Count
Source
724
242
    unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) {
725
242
        match self {
726
242
            SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len),
727
0
            _ => debug_unreachable!(),
728
        }
729
242
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap
Line
Count
Source
724
7.51M
    unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) {
725
7.51M
        match self {
726
7.51M
            SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len),
727
0
            _ => debug_unreachable!(),
728
        }
729
7.51M
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 2]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap
<smallvec::SmallVecData<[u8; 256]>>::heap
Line
Count
Source
724
804
    unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) {
725
804
        match self {
726
804
            SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len),
727
0
            _ => debug_unreachable!(),
728
        }
729
804
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 23]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::Match; 6]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap
Line
Count
Source
724
284k
    unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) {
725
284k
        match self {
726
284k
            SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len),
727
0
            _ => debug_unreachable!(),
728
        }
729
284k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap
Line
Count
Source
724
6.17k
    unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) {
725
6.17k
        match self {
726
6.17k
            SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len),
727
0
            _ => debug_unreachable!(),
728
        }
729
6.17k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap
730
    #[inline]
731
12.2M
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
12.2M
        match self {
733
12.2M
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
12.2M
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap_mut
Line
Count
Source
731
872
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
872
        match self {
733
872
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
872
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 2]>>::heap_mut
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap_mut
Line
Count
Source
731
1.91k
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
1.91k
        match self {
733
1.91k
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
1.91k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 2]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::heap_mut
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap_mut
Line
Count
Source
731
113
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
113
        match self {
733
113
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
113
    }
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
<smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut
Line
Count
Source
731
14
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
14
        match self {
733
14
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
14
    }
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
<smallvec::SmallVecData<[u8; 256]>>::heap_mut
Line
Count
Source
731
1.00k
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
1.00k
        match self {
733
1.00k
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
1.00k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 23]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::Match; 6]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Line
Count
Source
731
44.0k
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
44.0k
        match self {
733
44.0k
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
44.0k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
Line
Count
Source
731
785
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
785
        match self {
733
785
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
785
    }
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Line
Count
Source
731
5.43M
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
5.43M
        match self {
733
5.43M
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
5.43M
    }
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
Line
Count
Source
731
6.74M
    unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) {
732
6.74M
        match self {
733
6.74M
            SmallVecData::Heap { ptr, len } => (*ptr, len),
734
0
            _ => debug_unreachable!(),
735
        }
736
6.74M
    }
Unexecuted instantiation: <smallvec::SmallVecData<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::heap_mut
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::heap_mut
737
    #[inline]
738
128k
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
739
128k
        SmallVecData::Heap { ptr, len }
740
128k
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::from_heap
Line
Count
Source
738
242
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
739
242
        SmallVecData::Heap { ptr, len }
740
242
    }
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::from_heap
Line
Count
Source
738
975
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
739
975
        SmallVecData::Heap { ptr, len }
740
975
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 2]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_heap
<smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_heap
Line
Count
Source
738
14
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
739
14
        SmallVecData::Heap { ptr, len }
740
14
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_heap
<smallvec::SmallVecData<[u8; 256]>>::from_heap
Line
Count
Source
738
201
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
739
201
        SmallVecData::Heap { ptr, len }
740
201
    }
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 25]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 23]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::Match; 6]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_heap
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::from_heap
Line
Count
Source
738
123k
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
739
123k
        SmallVecData::Heap { ptr, len }
740
123k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_heap
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_heap
Line
Count
Source
738
2.84k
    fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> {
739
2.84k
        SmallVecData::Heap { ptr, len }
740
2.84k
    }
Unexecuted instantiation: <smallvec::SmallVecData<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::from_heap
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::from_heap
741
}
742
743
unsafe impl<A: Array + Send> Send for SmallVecData<A> {}
744
unsafe impl<A: Array + Sync> Sync for SmallVecData<A> {}
745
746
/// A `Vec`-like container that can store a small number of elements inline.
747
///
748
/// `SmallVec` acts like a vector, but can store a limited amount of data inline within the
749
/// `SmallVec` struct rather than in a separate allocation.  If the data exceeds this limit, the
750
/// `SmallVec` will "spill" its data onto the heap, allocating a new buffer to hold it.
751
///
752
/// The amount of data that a `SmallVec` can store inline depends on its backing store. The backing
753
/// store can be any type that implements the `Array` trait; usually it is a small fixed-sized
754
/// array.  For example a `SmallVec<[u64; 8]>` can hold up to eight 64-bit integers inline.
755
///
756
/// ## Example
757
///
758
/// ```rust
759
/// use smallvec::SmallVec;
760
/// let mut v = SmallVec::<[u8; 4]>::new(); // initialize an empty vector
761
///
762
/// // The vector can hold up to 4 items without spilling onto the heap.
763
/// v.extend(0..4);
764
/// assert_eq!(v.len(), 4);
765
/// assert!(!v.spilled());
766
///
767
/// // Pushing another element will force the buffer to spill:
768
/// v.push(4);
769
/// assert_eq!(v.len(), 5);
770
/// assert!(v.spilled());
771
/// ```
772
pub struct SmallVec<A: Array> {
773
    // The capacity field is used to determine which of the storage variants is active:
774
    // If capacity <= Self::inline_capacity() then the inline variant is used and capacity holds the current length of the vector (number of elements actually in use).
775
    // If capacity > Self::inline_capacity() then the heap variant is used and capacity holds the size of the memory allocation.
776
    capacity: usize,
777
    data: SmallVecData<A>,
778
}
779
780
impl<A: Array> SmallVec<A> {
781
    /// Construct an empty vector
782
    #[inline]
783
4.22M
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
4.22M
        assert!(
787
4.22M
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
4.22M
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
4.22M
        SmallVec {
791
4.22M
            capacity: 0,
792
4.22M
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
4.22M
        }
794
4.22M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::new
Line
Count
Source
783
18.2k
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
18.2k
        assert!(
787
18.2k
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
18.2k
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
18.2k
        SmallVec {
791
18.2k
            capacity: 0,
792
18.2k
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
18.2k
        }
794
18.2k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::new
Line
Count
Source
783
45.4k
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
45.4k
        assert!(
787
45.4k
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
45.4k
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
45.4k
        SmallVec {
791
45.4k
            capacity: 0,
792
45.4k
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
45.4k
        }
794
45.4k
    }
<smallvec::SmallVec<[u8; 2]>>::new
Line
Count
Source
783
50.8k
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
50.8k
        assert!(
787
50.8k
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
50.8k
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
50.8k
        SmallVec {
791
50.8k
            capacity: 0,
792
50.8k
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
50.8k
        }
794
50.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::new
<smallvec::SmallVec<[u8; 256]>>::new
Line
Count
Source
783
430
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
430
        assert!(
787
430
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
430
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
430
        SmallVec {
791
430
            capacity: 0,
792
430
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
430
        }
794
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::new
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::new
Line
Count
Source
783
7.71k
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
7.71k
        assert!(
787
7.71k
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
7.71k
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
7.71k
        SmallVec {
791
7.71k
            capacity: 0,
792
7.71k
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
7.71k
        }
794
7.71k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::new
Line
Count
Source
783
7.71k
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
7.71k
        assert!(
787
7.71k
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
7.71k
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
7.71k
        SmallVec {
791
7.71k
            capacity: 0,
792
7.71k
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
7.71k
        }
794
7.71k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::new
Line
Count
Source
783
4.09M
    pub fn new() -> SmallVec<A> {
784
        // Try to detect invalid custom implementations of `Array`. Hopefully,
785
        // this check should be optimized away entirely for valid ones.
786
4.09M
        assert!(
787
4.09M
            mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>()
788
4.09M
                && mem::align_of::<A>() >= mem::align_of::<A::Item>()
789
        );
790
4.09M
        SmallVec {
791
4.09M
            capacity: 0,
792
4.09M
            data: SmallVecData::from_inline(MaybeUninit::uninit()),
793
4.09M
        }
794
4.09M
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::new
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::new
795
796
    /// Construct an empty vector with enough capacity pre-allocated to store at least `n`
797
    /// elements.
798
    ///
799
    /// Will create a heap allocation only if `n` is larger than the inline capacity.
800
    ///
801
    /// ```
802
    /// # use smallvec::SmallVec;
803
    ///
804
    /// let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(100);
805
    ///
806
    /// assert!(v.is_empty());
807
    /// assert!(v.capacity() >= 100);
808
    /// ```
809
    #[inline]
810
430
    pub fn with_capacity(n: usize) -> Self {
811
430
        let mut v = SmallVec::new();
812
430
        v.reserve_exact(n);
813
430
        v
814
430
    }
815
816
    /// Construct a new `SmallVec` from a `Vec<A::Item>`.
817
    ///
818
    /// Elements will be copied to the inline buffer if `vec.capacity() <= Self::inline_capacity()`.
819
    ///
820
    /// ```rust
821
    /// use smallvec::SmallVec;
822
    ///
823
    /// let vec = vec![1, 2, 3, 4, 5];
824
    /// let small_vec: SmallVec<[_; 3]> = SmallVec::from_vec(vec);
825
    ///
826
    /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]);
827
    /// ```
828
    #[inline]
829
201
    pub fn from_vec(mut vec: Vec<A::Item>) -> SmallVec<A> {
830
201
        if vec.capacity() <= Self::inline_capacity() {
831
            // Cannot use Vec with smaller capacity
832
            // because we use value of `Self::capacity` field as indicator.
833
            unsafe {
834
187
                let mut data = SmallVecData::<A>::from_inline(MaybeUninit::uninit());
835
187
                let len = vec.len();
836
187
                vec.set_len(0);
837
187
                ptr::copy_nonoverlapping(vec.as_ptr(), data.inline_mut().as_ptr(), len);
838
839
187
                SmallVec {
840
187
                    capacity: len,
841
187
                    data,
842
187
                }
843
            }
844
        } else {
845
14
            let (ptr, cap, len) = (vec.as_mut_ptr(), vec.capacity(), vec.len());
846
14
            mem::forget(vec);
847
14
            let ptr = NonNull::new(ptr)
848
                // See docs: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.as_mut_ptr
849
14
                .expect("Cannot be null by `Vec` invariant");
850
851
14
            SmallVec {
852
14
                capacity: cap,
853
14
                data: SmallVecData::from_heap(ptr, len),
854
14
            }
855
        }
856
201
    }
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::from_vec
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::from_vec
Line
Count
Source
829
201
    pub fn from_vec(mut vec: Vec<A::Item>) -> SmallVec<A> {
830
201
        if vec.capacity() <= Self::inline_capacity() {
831
            // Cannot use Vec with smaller capacity
832
            // because we use value of `Self::capacity` field as indicator.
833
            unsafe {
834
187
                let mut data = SmallVecData::<A>::from_inline(MaybeUninit::uninit());
835
187
                let len = vec.len();
836
187
                vec.set_len(0);
837
187
                ptr::copy_nonoverlapping(vec.as_ptr(), data.inline_mut().as_ptr(), len);
838
839
187
                SmallVec {
840
187
                    capacity: len,
841
187
                    data,
842
187
                }
843
            }
844
        } else {
845
14
            let (ptr, cap, len) = (vec.as_mut_ptr(), vec.capacity(), vec.len());
846
14
            mem::forget(vec);
847
14
            let ptr = NonNull::new(ptr)
848
                // See docs: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.as_mut_ptr
849
14
                .expect("Cannot be null by `Vec` invariant");
850
851
14
            SmallVec {
852
14
                capacity: cap,
853
14
                data: SmallVecData::from_heap(ptr, len),
854
14
            }
855
        }
856
201
    }
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::from_vec
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::from_vec
857
858
    /// Constructs a new `SmallVec` on the stack from an `A` without
859
    /// copying elements.
860
    ///
861
    /// ```rust
862
    /// use smallvec::SmallVec;
863
    ///
864
    /// let buf = [1, 2, 3, 4, 5];
865
    /// let small_vec: SmallVec<_> = SmallVec::from_buf(buf);
866
    ///
867
    /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]);
868
    /// ```
869
    #[inline]
870
    pub fn from_buf(buf: A) -> SmallVec<A> {
871
        SmallVec {
872
            capacity: A::size(),
873
            data: SmallVecData::from_inline(MaybeUninit::new(buf)),
874
        }
875
    }
876
877
    /// Constructs a new `SmallVec` on the stack from an `A` without
878
    /// copying elements. Also sets the length, which must be less or
879
    /// equal to the size of `buf`.
880
    ///
881
    /// ```rust
882
    /// use smallvec::SmallVec;
883
    ///
884
    /// let buf = [1, 2, 3, 4, 5, 0, 0, 0];
885
    /// let small_vec: SmallVec<_> = SmallVec::from_buf_and_len(buf, 5);
886
    ///
887
    /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]);
888
    /// ```
889
    #[inline]
890
    pub fn from_buf_and_len(buf: A, len: usize) -> SmallVec<A> {
891
        assert!(len <= A::size());
892
        unsafe { SmallVec::from_buf_and_len_unchecked(MaybeUninit::new(buf), len) }
893
    }
894
895
    /// Constructs a new `SmallVec` on the stack from an `A` without
896
    /// copying elements. Also sets the length. The user is responsible
897
    /// for ensuring that `len <= A::size()`.
898
    ///
899
    /// ```rust
900
    /// use smallvec::SmallVec;
901
    /// use std::mem::MaybeUninit;
902
    ///
903
    /// let buf = [1, 2, 3, 4, 5, 0, 0, 0];
904
    /// let small_vec: SmallVec<_> = unsafe {
905
    ///     SmallVec::from_buf_and_len_unchecked(MaybeUninit::new(buf), 5)
906
    /// };
907
    ///
908
    /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]);
909
    /// ```
910
    #[inline]
911
    pub unsafe fn from_buf_and_len_unchecked(buf: MaybeUninit<A>, len: usize) -> SmallVec<A> {
912
        SmallVec {
913
            capacity: len,
914
            data: SmallVecData::from_inline(buf),
915
        }
916
    }
917
918
    /// Sets the length of a vector.
919
    ///
920
    /// This will explicitly set the size of the vector, without actually
921
    /// modifying its buffers, so it is up to the caller to ensure that the
922
    /// vector is actually the specified size.
923
1.60k
    pub unsafe fn set_len(&mut self, new_len: usize) {
924
1.60k
        let (_, len_ptr, _) = self.triple_mut();
925
1.60k
        *len_ptr = new_len;
926
1.60k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::set_len
Line
Count
Source
923
1.17k
    pub unsafe fn set_len(&mut self, new_len: usize) {
924
1.17k
        let (_, len_ptr, _) = self.triple_mut();
925
1.17k
        *len_ptr = new_len;
926
1.17k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::set_len
<smallvec::SmallVec<[u8; 256]>>::set_len
Line
Count
Source
923
430
    pub unsafe fn set_len(&mut self, new_len: usize) {
924
430
        let (_, len_ptr, _) = self.triple_mut();
925
430
        *len_ptr = new_len;
926
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::set_len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::set_len
927
928
    /// The maximum number of elements this vector can hold inline
929
    #[inline]
930
60.8M
    fn inline_capacity() -> usize {
931
60.8M
        if mem::size_of::<A::Item>() > 0 {
932
60.8M
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
60.8M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::inline_capacity
Line
Count
Source
930
110k
    fn inline_capacity() -> usize {
931
110k
        if mem::size_of::<A::Item>() > 0 {
932
110k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
110k
    }
<smallvec::SmallVec<[u8; 2]>>::inline_capacity
Line
Count
Source
930
134k
    fn inline_capacity() -> usize {
931
134k
        if mem::size_of::<A::Item>() > 0 {
932
134k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
134k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::inline_capacity
Line
Count
Source
930
7.86M
    fn inline_capacity() -> usize {
931
7.86M
        if mem::size_of::<A::Item>() > 0 {
932
7.86M
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
7.86M
    }
<smallvec::SmallVec<[u8; 2]>>::inline_capacity
Line
Count
Source
930
353k
    fn inline_capacity() -> usize {
931
353k
        if mem::size_of::<A::Item>() > 0 {
932
353k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
353k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::inline_capacity
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::inline_capacity
Line
Count
Source
930
19.7k
    fn inline_capacity() -> usize {
931
19.7k
        if mem::size_of::<A::Item>() > 0 {
932
19.7k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
19.7k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity
Line
Count
Source
930
201
    fn inline_capacity() -> usize {
931
201
        if mem::size_of::<A::Item>() > 0 {
932
201
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
201
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity
Line
Count
Source
930
575
    fn inline_capacity() -> usize {
931
575
        if mem::size_of::<A::Item>() > 0 {
932
575
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
575
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
<smallvec::SmallVec<[u8; 256]>>::inline_capacity
Line
Count
Source
930
7.82k
    fn inline_capacity() -> usize {
931
7.82k
        if mem::size_of::<A::Item>() > 0 {
932
7.82k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
7.82k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Line
Count
Source
930
12.0M
    fn inline_capacity() -> usize {
931
12.0M
        if mem::size_of::<A::Item>() > 0 {
932
12.0M
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
12.0M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Line
Count
Source
930
23.1k
    fn inline_capacity() -> usize {
931
23.1k
        if mem::size_of::<A::Item>() > 0 {
932
23.1k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
23.1k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
Line
Count
Source
930
21.5k
    fn inline_capacity() -> usize {
931
21.5k
        if mem::size_of::<A::Item>() > 0 {
932
21.5k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
21.5k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Line
Count
Source
930
33.2M
    fn inline_capacity() -> usize {
931
33.2M
        if mem::size_of::<A::Item>() > 0 {
932
33.2M
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
33.2M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Line
Count
Source
930
239k
    fn inline_capacity() -> usize {
931
239k
        if mem::size_of::<A::Item>() > 0 {
932
239k
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
239k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
Line
Count
Source
930
6.82M
    fn inline_capacity() -> usize {
931
6.82M
        if mem::size_of::<A::Item>() > 0 {
932
6.82M
            A::size()
933
        } else {
934
            // For zero-size items code like `ptr.add(offset)` always returns the same pointer.
935
            // Therefore all items are at the same address,
936
            // and any array size has capacity for infinitely many items.
937
            // The capacity is limited by the bit width of the length field.
938
            //
939
            // `Vec` also does this:
940
            // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186
941
            //
942
            // In our case, this also ensures that a smallvec of zero-size items never spills,
943
            // and we never try to allocate zero bytes which `std::alloc::alloc` disallows.
944
0
            core::usize::MAX
945
        }
946
6.82M
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity
947
948
    /// The maximum number of elements this vector can hold inline
949
    #[inline]
950
    pub fn inline_size(&self) -> usize {
951
        Self::inline_capacity()
952
    }
953
954
    /// The number of elements stored in the vector
955
    #[inline]
956
1.26M
    pub fn len(&self) -> usize {
957
1.26M
        self.triple().1
958
1.26M
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::len
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::len
Line
Count
Source
956
13.5k
    pub fn len(&self) -> usize {
957
13.5k
        self.triple().1
958
13.5k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 2]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::len
<smallvec::SmallVec<[u8; 256]>>::len
Line
Count
Source
956
860
    pub fn len(&self) -> usize {
957
860
        self.triple().1
958
860
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::len
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::len
Line
Count
Source
956
1.12M
    pub fn len(&self) -> usize {
957
1.12M
        self.triple().1
958
1.12M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::len
Line
Count
Source
956
114k
    pub fn len(&self) -> usize {
957
114k
        self.triple().1
958
114k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::len
Line
Count
Source
956
5.68k
    pub fn len(&self) -> usize {
957
5.68k
        self.triple().1
958
5.68k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::len
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::len
959
960
    /// Returns `true` if the vector is empty
961
    #[inline]
962
977k
    pub fn is_empty(&self) -> bool {
963
977k
        self.len() == 0
964
977k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::is_empty
Line
Count
Source
962
12.2k
    pub fn is_empty(&self) -> bool {
963
12.2k
        self.len() == 0
964
12.2k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::is_empty
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::is_empty
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::is_empty
Line
Count
Source
962
850k
    pub fn is_empty(&self) -> bool {
963
850k
        self.len() == 0
964
850k
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::is_empty
Line
Count
Source
962
114k
    pub fn is_empty(&self) -> bool {
963
114k
        self.len() == 0
964
114k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::is_empty
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::is_empty
965
966
    /// The number of items the vector can hold without reallocating
967
    #[inline]
968
123k
    pub fn capacity(&self) -> usize {
969
123k
        self.triple().2
970
123k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::capacity
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::capacity
Line
Count
Source
968
18
    pub fn capacity(&self) -> usize {
969
18
        self.triple().2
970
18
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 2]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::capacity
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::capacity
Line
Count
Source
968
120k
    pub fn capacity(&self) -> usize {
969
120k
        self.triple().2
970
120k
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::capacity
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::capacity
Line
Count
Source
968
2.84k
    pub fn capacity(&self) -> usize {
969
2.84k
        self.triple().2
970
2.84k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::capacity
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::capacity
971
972
    /// Returns a tuple with (data ptr, len, capacity)
973
    /// Useful to get all `SmallVec` properties with a single check of the current storage variant.
974
    #[inline]
975
12.3M
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
12.3M
            if self.spilled() {
978
7.80M
                let (ptr, len) = self.data.heap();
979
7.80M
                (ptr, len, self.capacity)
980
            } else {
981
4.56M
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
12.3M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple
Line
Count
Source
975
6.14k
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
6.14k
            if self.spilled() {
978
242
                let (ptr, len) = self.data.heap();
979
242
                (ptr, len, self.capacity)
980
            } else {
981
5.90k
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
6.14k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple
Line
Count
Source
975
7.59M
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
7.59M
            if self.spilled() {
978
7.51M
                let (ptr, len) = self.data.heap();
979
7.51M
                (ptr, len, self.capacity)
980
            } else {
981
84.8k
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
7.59M
    }
<smallvec::SmallVec<[u8; 2]>>::triple
Line
Count
Source
975
65.8k
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
65.8k
            if self.spilled() {
978
0
                let (ptr, len) = self.data.heap();
979
0
                (ptr, len, self.capacity)
980
            } else {
981
65.8k
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
65.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple
<smallvec::SmallVec<[u8; 256]>>::triple
Line
Count
Source
975
1.72k
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
1.72k
            if self.spilled() {
978
804
                let (ptr, len) = self.data.heap();
979
804
                (ptr, len, self.capacity)
980
            } else {
981
916
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
1.72k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple
Line
Count
Source
975
4.57M
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
4.57M
            if self.spilled() {
978
284k
                let (ptr, len) = self.data.heap();
979
284k
                (ptr, len, self.capacity)
980
            } else {
981
4.29M
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
4.57M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple
Line
Count
Source
975
114k
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
114k
            if self.spilled() {
978
0
                let (ptr, len) = self.data.heap();
979
0
                (ptr, len, self.capacity)
980
            } else {
981
114k
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
114k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple
Line
Count
Source
975
8.53k
    fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) {
976
        unsafe {
977
8.53k
            if self.spilled() {
978
6.17k
                let (ptr, len) = self.data.heap();
979
6.17k
                (ptr, len, self.capacity)
980
            } else {
981
2.35k
                (self.data.inline(), self.capacity, Self::inline_capacity())
982
            }
983
        }
984
8.53k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple
985
986
    /// Returns a tuple with (data ptr, len ptr, capacity)
987
    #[inline]
988
25.7M
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
25.7M
            if self.spilled() {
991
12.0M
                let (ptr, len_ptr) = self.data.heap_mut();
992
12.0M
                (ptr, len_ptr, self.capacity)
993
            } else {
994
13.7M
                (
995
13.7M
                    self.data.inline_mut(),
996
13.7M
                    &mut self.capacity,
997
13.7M
                    Self::inline_capacity(),
998
13.7M
                )
999
            }
1000
        }
1001
25.7M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple_mut
Line
Count
Source
988
36.8k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
36.8k
            if self.spilled() {
991
242
                let (ptr, len_ptr) = self.data.heap_mut();
992
242
                (ptr, len_ptr, self.capacity)
993
            } else {
994
36.5k
                (
995
36.5k
                    self.data.inline_mut(),
996
36.5k
                    &mut self.capacity,
997
36.5k
                    Self::inline_capacity(),
998
36.5k
                )
999
            }
1000
        }
1001
36.8k
    }
<smallvec::SmallVec<[u8; 2]>>::triple_mut
Line
Count
Source
988
44.7k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
44.7k
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
44.7k
                (
995
44.7k
                    self.data.inline_mut(),
996
44.7k
                    &mut self.capacity,
997
44.7k
                    Self::inline_capacity(),
998
44.7k
                )
999
            }
1000
        }
1001
44.7k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple_mut
Line
Count
Source
988
76.3k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
76.3k
            if self.spilled() {
991
1.60k
                let (ptr, len_ptr) = self.data.heap_mut();
992
1.60k
                (ptr, len_ptr, self.capacity)
993
            } else {
994
74.7k
                (
995
74.7k
                    self.data.inline_mut(),
996
74.7k
                    &mut self.capacity,
997
74.7k
                    Self::inline_capacity(),
998
74.7k
                )
999
            }
1000
        }
1001
76.3k
    }
<smallvec::SmallVec<[u8; 2]>>::triple_mut
Line
Count
Source
988
107k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
107k
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
107k
                (
995
107k
                    self.data.inline_mut(),
996
107k
                    &mut self.capacity,
997
107k
                    Self::inline_capacity(),
998
107k
                )
999
            }
1000
        }
1001
107k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::triple_mut
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple_mut
Line
Count
Source
988
6.53k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
6.53k
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
6.53k
                (
995
6.53k
                    self.data.inline_mut(),
996
6.53k
                    &mut self.capacity,
997
6.53k
                    Self::inline_capacity(),
998
6.53k
                )
999
            }
1000
        }
1001
6.53k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut
Line
Count
Source
988
187
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
187
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
187
                (
995
187
                    self.data.inline_mut(),
996
187
                    &mut self.capacity,
997
187
                    Self::inline_capacity(),
998
187
                )
999
            }
1000
        }
1001
187
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
<smallvec::SmallVec<[u8; 256]>>::triple_mut
Line
Count
Source
988
2.58k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
2.58k
            if self.spilled() {
991
804
                let (ptr, len_ptr) = self.data.heap_mut();
992
804
                (ptr, len_ptr, self.capacity)
993
            } else {
994
1.77k
                (
995
1.77k
                    self.data.inline_mut(),
996
1.77k
                    &mut self.capacity,
997
1.77k
                    Self::inline_capacity(),
998
1.77k
                )
999
            }
1000
        }
1001
2.58k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Line
Count
Source
988
4.00M
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
4.00M
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
4.00M
                (
995
4.00M
                    self.data.inline_mut(),
996
4.00M
                    &mut self.capacity,
997
4.00M
                    Self::inline_capacity(),
998
4.00M
                )
999
            }
1000
        }
1001
4.00M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Line
Count
Source
988
7.71k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
7.71k
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
7.71k
                (
995
7.71k
                    self.data.inline_mut(),
996
7.71k
                    &mut self.capacity,
997
7.71k
                    Self::inline_capacity(),
998
7.71k
                )
999
            }
1000
        }
1001
7.71k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
Line
Count
Source
988
6.93k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
6.93k
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
6.93k
                (
995
6.93k
                    self.data.inline_mut(),
996
6.93k
                    &mut self.capacity,
997
6.93k
                    Self::inline_capacity(),
998
6.93k
                )
999
            }
1000
        }
1001
6.93k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Line
Count
Source
988
14.6M
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
14.6M
            if self.spilled() {
991
5.30M
                let (ptr, len_ptr) = self.data.heap_mut();
992
5.30M
                (ptr, len_ptr, self.capacity)
993
            } else {
994
9.38M
                (
995
9.38M
                    self.data.inline_mut(),
996
9.38M
                    &mut self.capacity,
997
9.38M
                    Self::inline_capacity(),
998
9.38M
                )
999
            }
1000
        }
1001
14.6M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Line
Count
Source
988
5.26k
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
5.26k
            if self.spilled() {
991
0
                let (ptr, len_ptr) = self.data.heap_mut();
992
0
                (ptr, len_ptr, self.capacity)
993
            } else {
994
5.26k
                (
995
5.26k
                    self.data.inline_mut(),
996
5.26k
                    &mut self.capacity,
997
5.26k
                    Self::inline_capacity(),
998
5.26k
                )
999
            }
1000
        }
1001
5.26k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
Line
Count
Source
988
6.77M
    fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) {
989
        unsafe {
990
6.77M
            if self.spilled() {
991
6.74M
                let (ptr, len_ptr) = self.data.heap_mut();
992
6.74M
                (ptr, len_ptr, self.capacity)
993
            } else {
994
32.2k
                (
995
32.2k
                    self.data.inline_mut(),
996
32.2k
                    &mut self.capacity,
997
32.2k
                    Self::inline_capacity(),
998
32.2k
                )
999
            }
1000
        }
1001
6.77M
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut
1002
1003
    /// Returns `true` if the data has spilled into a separate heap-allocated buffer.
1004
    #[inline]
1005
42.4M
    pub fn spilled(&self) -> bool {
1006
42.4M
        self.capacity > Self::inline_capacity()
1007
42.4M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::spilled
Line
Count
Source
1005
68.0k
    pub fn spilled(&self) -> bool {
1006
68.0k
        self.capacity > Self::inline_capacity()
1007
68.0k
    }
<smallvec::SmallVec<[u8; 2]>>::spilled
Line
Count
Source
1005
89.4k
    pub fn spilled(&self) -> bool {
1006
89.4k
        self.capacity > Self::inline_capacity()
1007
89.4k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::spilled
Line
Count
Source
1005
7.70M
    pub fn spilled(&self) -> bool {
1006
7.70M
        self.capacity > Self::inline_capacity()
1007
7.70M
    }
<smallvec::SmallVec<[u8; 2]>>::spilled
Line
Count
Source
1005
179k
    pub fn spilled(&self) -> bool {
1006
179k
        self.capacity > Self::inline_capacity()
1007
179k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::spilled
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::spilled
Line
Count
Source
1005
13.1k
    pub fn spilled(&self) -> bool {
1006
13.1k
        self.capacity > Self::inline_capacity()
1007
13.1k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled
Line
Count
Source
1005
388
    pub fn spilled(&self) -> bool {
1006
388
        self.capacity > Self::inline_capacity()
1007
388
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
<smallvec::SmallVec<[u8; 256]>>::spilled
Line
Count
Source
1005
4.93k
    pub fn spilled(&self) -> bool {
1006
4.93k
        self.capacity > Self::inline_capacity()
1007
4.93k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Line
Count
Source
1005
8.05M
    pub fn spilled(&self) -> bool {
1006
8.05M
        self.capacity > Self::inline_capacity()
1007
8.05M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Line
Count
Source
1005
15.4k
    pub fn spilled(&self) -> bool {
1006
15.4k
        self.capacity > Self::inline_capacity()
1007
15.4k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
Line
Count
Source
1005
14.6k
    pub fn spilled(&self) -> bool {
1006
14.6k
        self.capacity > Self::inline_capacity()
1007
14.6k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Line
Count
Source
1005
19.4M
    pub fn spilled(&self) -> bool {
1006
19.4M
        self.capacity > Self::inline_capacity()
1007
19.4M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Line
Count
Source
1005
119k
    pub fn spilled(&self) -> bool {
1006
119k
        self.capacity > Self::inline_capacity()
1007
119k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
Line
Count
Source
1005
6.78M
    pub fn spilled(&self) -> bool {
1006
6.78M
        self.capacity > Self::inline_capacity()
1007
6.78M
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled
1008
1009
    /// Creates a draining iterator that removes the specified range in the vector
1010
    /// and yields the removed items.
1011
    ///
1012
    /// Note 1: The element range is removed even if the iterator is only
1013
    /// partially consumed or not consumed at all.
1014
    ///
1015
    /// Note 2: It is unspecified how many elements are removed from the vector
1016
    /// if the `Drain` value is leaked.
1017
    ///
1018
    /// # Panics
1019
    ///
1020
    /// Panics if the starting point is greater than the end point or if
1021
    /// the end point is greater than the length of the vector.
1022
    pub fn drain<R>(&mut self, range: R) -> Drain<'_, A>
1023
    where
1024
        R: RangeBounds<usize>,
1025
    {
1026
        use core::ops::Bound::*;
1027
1028
        let len = self.len();
1029
        let start = match range.start_bound() {
1030
            Included(&n) => n,
1031
            Excluded(&n) => n.checked_add(1).expect("Range start out of bounds"),
1032
            Unbounded => 0,
1033
        };
1034
        let end = match range.end_bound() {
1035
            Included(&n) => n.checked_add(1).expect("Range end out of bounds"),
1036
            Excluded(&n) => n,
1037
            Unbounded => len,
1038
        };
1039
1040
        assert!(start <= end);
1041
        assert!(end <= len);
1042
1043
        unsafe {
1044
            self.set_len(start);
1045
1046
            let range_slice = slice::from_raw_parts(self.as_ptr().add(start), end - start);
1047
1048
            Drain {
1049
                tail_start: end,
1050
                tail_len: len - end,
1051
                iter: range_slice.iter(),
1052
                // Since self is a &mut, passing it to a function would invalidate the slice iterator.
1053
                vec: NonNull::new_unchecked(self as *mut _),
1054
            }
1055
        }
1056
    }
1057
1058
    #[cfg(feature = "drain_filter")]
1059
    /// Creates an iterator which uses a closure to determine if an element should be removed.
1060
    ///
1061
    /// If the closure returns true, the element is removed and yielded. If the closure returns
1062
    /// false, the element will remain in the vector and will not be yielded by the iterator.
1063
    ///
1064
    /// Using this method is equivalent to the following code:
1065
    /// ```
1066
    /// # use smallvec::SmallVec;
1067
    /// # let some_predicate = |x: &mut i32| { *x == 2 || *x == 3 || *x == 6 };
1068
    /// # let mut vec: SmallVec<[i32; 8]> = SmallVec::from_slice(&[1i32, 2, 3, 4, 5, 6]);
1069
    /// let mut i = 0;
1070
    /// while i < vec.len() {
1071
    ///     if some_predicate(&mut vec[i]) {
1072
    ///         let val = vec.remove(i);
1073
    ///         // your code here
1074
    ///     } else {
1075
    ///         i += 1;
1076
    ///     }
1077
    /// }
1078
    ///
1079
    /// # assert_eq!(vec, SmallVec::<[i32; 8]>::from_slice(&[1i32, 4, 5]));
1080
    /// ```
1081
    /// ///
1082
    /// But `drain_filter` is easier to use. `drain_filter` is also more efficient,
1083
    /// because it can backshift the elements of the array in bulk.
1084
    ///
1085
    /// Note that `drain_filter` also lets you mutate every element in the filter closure,
1086
    /// regardless of whether you choose to keep or remove it.
1087
    ///
1088
    /// # Examples
1089
    ///
1090
    /// Splitting an array into evens and odds, reusing the original allocation:
1091
    ///
1092
    /// ```
1093
    /// # use smallvec::SmallVec;
1094
    /// let mut numbers: SmallVec<[i32; 16]> = SmallVec::from_slice(&[1i32, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15]);
1095
    ///
1096
    /// let evens = numbers.drain_filter(|x| *x % 2 == 0).collect::<SmallVec<[i32; 16]>>();
1097
    /// let odds = numbers;
1098
    ///
1099
    /// assert_eq!(evens, SmallVec::<[i32; 16]>::from_slice(&[2i32, 4, 6, 8, 14]));
1100
    /// assert_eq!(odds, SmallVec::<[i32; 16]>::from_slice(&[1i32, 3, 5, 9, 11, 13, 15]));
1101
    /// ```
1102
    pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, A, F,>
1103
    where
1104
        F: FnMut(&mut A::Item) -> bool,
1105
    {
1106
        let old_len = self.len();
1107
1108
        // Guard against us getting leaked (leak amplification)
1109
        unsafe {
1110
            self.set_len(0);
1111
        }
1112
1113
        DrainFilter { vec: self, idx: 0, del: 0, old_len, pred: filter, panic_flag: false }
1114
    }
1115
1116
    /// Append an item to the vector.
1117
    #[inline]
1118
8.56M
    pub fn push(&mut self, value: A::Item) {
1119
        unsafe {
1120
8.56M
            let (mut ptr, mut len, cap) = self.triple_mut();
1121
8.56M
            if *len == cap {
1122
123k
                self.reserve_one_unchecked();
1123
123k
                let (heap_ptr, heap_len) = self.data.heap_mut();
1124
123k
                ptr = heap_ptr;
1125
123k
                len = heap_len;
1126
8.44M
            }
1127
8.56M
            ptr::write(ptr.as_ptr().add(*len), value);
1128
8.56M
            *len += 1;
1129
        }
1130
8.56M
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::push
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::push
Line
Count
Source
1118
212
    pub fn push(&mut self, value: A::Item) {
1119
        unsafe {
1120
212
            let (mut ptr, mut len, cap) = self.triple_mut();
1121
212
            if *len == cap {
1122
18
                self.reserve_one_unchecked();
1123
18
                let (heap_ptr, heap_len) = self.data.heap_mut();
1124
18
                ptr = heap_ptr;
1125
18
                len = heap_len;
1126
194
            }
1127
212
            ptr::write(ptr.as_ptr().add(*len), value);
1128
212
            *len += 1;
1129
        }
1130
212
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 2]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::push
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::push
Line
Count
Source
1118
5.22M
    pub fn push(&mut self, value: A::Item) {
1119
        unsafe {
1120
5.22M
            let (mut ptr, mut len, cap) = self.triple_mut();
1121
5.22M
            if *len == cap {
1122
120k
                self.reserve_one_unchecked();
1123
120k
                let (heap_ptr, heap_len) = self.data.heap_mut();
1124
120k
                ptr = heap_ptr;
1125
120k
                len = heap_len;
1126
5.10M
            }
1127
5.22M
            ptr::write(ptr.as_ptr().add(*len), value);
1128
5.22M
            *len += 1;
1129
        }
1130
5.22M
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::push
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::push
Line
Count
Source
1118
3.34M
    pub fn push(&mut self, value: A::Item) {
1119
        unsafe {
1120
3.34M
            let (mut ptr, mut len, cap) = self.triple_mut();
1121
3.34M
            if *len == cap {
1122
2.84k
                self.reserve_one_unchecked();
1123
2.84k
                let (heap_ptr, heap_len) = self.data.heap_mut();
1124
2.84k
                ptr = heap_ptr;
1125
2.84k
                len = heap_len;
1126
3.33M
            }
1127
3.34M
            ptr::write(ptr.as_ptr().add(*len), value);
1128
3.34M
            *len += 1;
1129
        }
1130
3.34M
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::push
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::push
1131
1132
    /// Remove an item from the end of the vector and return it, or None if empty.
1133
    #[inline]
1134
3.36M
    pub fn pop(&mut self) -> Option<A::Item> {
1135
        unsafe {
1136
3.36M
            let (ptr, len_ptr, _) = self.triple_mut();
1137
3.36M
            let ptr: *const _ = ptr.as_ptr();
1138
3.36M
            if *len_ptr == 0 {
1139
25.5k
                return None;
1140
3.34M
            }
1141
3.34M
            let last_index = *len_ptr - 1;
1142
3.34M
            *len_ptr = last_index;
1143
3.34M
            Some(ptr::read(ptr.add(last_index)))
1144
        }
1145
3.36M
    }
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::pop
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::pop
Line
Count
Source
1134
3.36M
    pub fn pop(&mut self) -> Option<A::Item> {
1135
        unsafe {
1136
3.36M
            let (ptr, len_ptr, _) = self.triple_mut();
1137
3.36M
            let ptr: *const _ = ptr.as_ptr();
1138
3.36M
            if *len_ptr == 0 {
1139
25.5k
                return None;
1140
3.34M
            }
1141
3.34M
            let last_index = *len_ptr - 1;
1142
3.34M
            *len_ptr = last_index;
1143
3.34M
            Some(ptr::read(ptr.add(last_index)))
1144
        }
1145
3.36M
    }
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::pop
1146
1147
    /// Moves all the elements of `other` into `self`, leaving `other` empty.
1148
    ///
1149
    /// # Example
1150
    ///
1151
    /// ```
1152
    /// # use smallvec::{SmallVec, smallvec};
1153
    /// let mut v0: SmallVec<[u8; 16]> = smallvec![1, 2, 3];
1154
    /// let mut v1: SmallVec<[u8; 32]> = smallvec![4, 5, 6];
1155
    /// v0.append(&mut v1);
1156
    /// assert_eq!(*v0, [1, 2, 3, 4, 5, 6]);
1157
    /// assert_eq!(*v1, []);
1158
    /// ```
1159
    pub fn append<B>(&mut self, other: &mut SmallVec<B>)
1160
    where
1161
        B: Array<Item = A::Item>,
1162
    {
1163
        self.extend(other.drain(..))
1164
    }
1165
1166
    /// Re-allocate to set the capacity to `max(new_cap, inline_size())`.
1167
    ///
1168
    /// Panics if `new_cap` is less than the vector's length
1169
    /// or if the capacity computation overflows `usize`.
1170
    pub fn grow(&mut self, new_cap: usize) {
1171
        infallible(self.try_grow(new_cap))
1172
    }
1173
1174
    /// Re-allocate to set the capacity to `max(new_cap, inline_size())`.
1175
    ///
1176
    /// Panics if `new_cap` is less than the vector's length
1177
128k
    pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> {
1178
        unsafe {
1179
128k
            let unspilled = !self.spilled();
1180
128k
            let (ptr, &mut len, cap) = self.triple_mut();
1181
128k
            assert!(new_cap >= len);
1182
128k
            if new_cap <= Self::inline_capacity() {
1183
0
                if unspilled {
1184
0
                    return Ok(());
1185
0
                }
1186
0
                self.data = SmallVecData::from_inline(MaybeUninit::uninit());
1187
0
                ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len);
1188
0
                self.capacity = len;
1189
0
                deallocate(ptr, cap);
1190
128k
            } else if new_cap != cap {
1191
128k
                let layout = layout_array::<A::Item>(new_cap)?;
1192
128k
                debug_assert!(layout.size() > 0);
1193
                let new_alloc;
1194
128k
                if unspilled {
1195
54.0k
                    new_alloc = NonNull::new(alloc::alloc::alloc(layout))
1196
54.0k
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1197
54.0k
                        .cast();
1198
54.0k
                    ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len);
1199
                } else {
1200
                    // This should never fail since the same succeeded
1201
                    // when previously allocating `ptr`.
1202
74.1k
                    let old_layout = layout_array::<A::Item>(cap)?;
1203
1204
74.1k
                    let new_ptr =
1205
74.1k
                        alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size());
1206
74.1k
                    new_alloc = NonNull::new(new_ptr)
1207
74.1k
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1208
74.1k
                        .cast();
1209
                }
1210
128k
                self.data = SmallVecData::from_heap(new_alloc, len);
1211
128k
                self.capacity = new_cap;
1212
0
            }
1213
128k
            Ok(())
1214
        }
1215
128k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_grow
Line
Count
Source
1177
242
    pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> {
1178
        unsafe {
1179
242
            let unspilled = !self.spilled();
1180
242
            let (ptr, &mut len, cap) = self.triple_mut();
1181
242
            assert!(new_cap >= len);
1182
242
            if new_cap <= Self::inline_capacity() {
1183
0
                if unspilled {
1184
0
                    return Ok(());
1185
0
                }
1186
0
                self.data = SmallVecData::from_inline(MaybeUninit::uninit());
1187
0
                ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len);
1188
0
                self.capacity = len;
1189
0
                deallocate(ptr, cap);
1190
242
            } else if new_cap != cap {
1191
242
                let layout = layout_array::<A::Item>(new_cap)?;
1192
242
                debug_assert!(layout.size() > 0);
1193
                let new_alloc;
1194
242
                if unspilled {
1195
242
                    new_alloc = NonNull::new(alloc::alloc::alloc(layout))
1196
242
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1197
242
                        .cast();
1198
242
                    ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len);
1199
                } else {
1200
                    // This should never fail since the same succeeded
1201
                    // when previously allocating `ptr`.
1202
0
                    let old_layout = layout_array::<A::Item>(cap)?;
1203
1204
0
                    let new_ptr =
1205
0
                        alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size());
1206
0
                    new_alloc = NonNull::new(new_ptr)
1207
0
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1208
0
                        .cast();
1209
                }
1210
242
                self.data = SmallVecData::from_heap(new_alloc, len);
1211
242
                self.capacity = new_cap;
1212
0
            }
1213
242
            Ok(())
1214
        }
1215
242
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_grow
Line
Count
Source
1177
975
    pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> {
1178
        unsafe {
1179
975
            let unspilled = !self.spilled();
1180
975
            let (ptr, &mut len, cap) = self.triple_mut();
1181
975
            assert!(new_cap >= len);
1182
975
            if new_cap <= Self::inline_capacity() {
1183
0
                if unspilled {
1184
0
                    return Ok(());
1185
0
                }
1186
0
                self.data = SmallVecData::from_inline(MaybeUninit::uninit());
1187
0
                ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len);
1188
0
                self.capacity = len;
1189
0
                deallocate(ptr, cap);
1190
975
            } else if new_cap != cap {
1191
975
                let layout = layout_array::<A::Item>(new_cap)?;
1192
975
                debug_assert!(layout.size() > 0);
1193
                let new_alloc;
1194
975
                if unspilled {
1195
794
                    new_alloc = NonNull::new(alloc::alloc::alloc(layout))
1196
794
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1197
794
                        .cast();
1198
794
                    ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len);
1199
                } else {
1200
                    // This should never fail since the same succeeded
1201
                    // when previously allocating `ptr`.
1202
181
                    let old_layout = layout_array::<A::Item>(cap)?;
1203
1204
181
                    let new_ptr =
1205
181
                        alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size());
1206
181
                    new_alloc = NonNull::new(new_ptr)
1207
181
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1208
181
                        .cast();
1209
                }
1210
975
                self.data = SmallVecData::from_heap(new_alloc, len);
1211
975
                self.capacity = new_cap;
1212
0
            }
1213
975
            Ok(())
1214
        }
1215
975
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 2]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_grow
<smallvec::SmallVec<[u8; 256]>>::try_grow
Line
Count
Source
1177
201
    pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> {
1178
        unsafe {
1179
201
            let unspilled = !self.spilled();
1180
201
            let (ptr, &mut len, cap) = self.triple_mut();
1181
201
            assert!(new_cap >= len);
1182
201
            if new_cap <= Self::inline_capacity() {
1183
0
                if unspilled {
1184
0
                    return Ok(());
1185
0
                }
1186
0
                self.data = SmallVecData::from_inline(MaybeUninit::uninit());
1187
0
                ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len);
1188
0
                self.capacity = len;
1189
0
                deallocate(ptr, cap);
1190
201
            } else if new_cap != cap {
1191
201
                let layout = layout_array::<A::Item>(new_cap)?;
1192
201
                debug_assert!(layout.size() > 0);
1193
                let new_alloc;
1194
201
                if unspilled {
1195
201
                    new_alloc = NonNull::new(alloc::alloc::alloc(layout))
1196
201
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1197
201
                        .cast();
1198
201
                    ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len);
1199
                } else {
1200
                    // This should never fail since the same succeeded
1201
                    // when previously allocating `ptr`.
1202
0
                    let old_layout = layout_array::<A::Item>(cap)?;
1203
1204
0
                    let new_ptr =
1205
0
                        alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size());
1206
0
                    new_alloc = NonNull::new(new_ptr)
1207
0
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1208
0
                        .cast();
1209
                }
1210
201
                self.data = SmallVecData::from_heap(new_alloc, len);
1211
201
                self.capacity = new_cap;
1212
0
            }
1213
201
            Ok(())
1214
        }
1215
201
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::try_grow
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::try_grow
Line
Count
Source
1177
123k
    pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> {
1178
        unsafe {
1179
123k
            let unspilled = !self.spilled();
1180
123k
            let (ptr, &mut len, cap) = self.triple_mut();
1181
123k
            assert!(new_cap >= len);
1182
123k
            if new_cap <= Self::inline_capacity() {
1183
0
                if unspilled {
1184
0
                    return Ok(());
1185
0
                }
1186
0
                self.data = SmallVecData::from_inline(MaybeUninit::uninit());
1187
0
                ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len);
1188
0
                self.capacity = len;
1189
0
                deallocate(ptr, cap);
1190
123k
            } else if new_cap != cap {
1191
123k
                let layout = layout_array::<A::Item>(new_cap)?;
1192
123k
                debug_assert!(layout.size() > 0);
1193
                let new_alloc;
1194
123k
                if unspilled {
1195
52.0k
                    new_alloc = NonNull::new(alloc::alloc::alloc(layout))
1196
52.0k
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1197
52.0k
                        .cast();
1198
52.0k
                    ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len);
1199
                } else {
1200
                    // This should never fail since the same succeeded
1201
                    // when previously allocating `ptr`.
1202
71.9k
                    let old_layout = layout_array::<A::Item>(cap)?;
1203
1204
71.9k
                    let new_ptr =
1205
71.9k
                        alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size());
1206
71.9k
                    new_alloc = NonNull::new(new_ptr)
1207
71.9k
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1208
71.9k
                        .cast();
1209
                }
1210
123k
                self.data = SmallVecData::from_heap(new_alloc, len);
1211
123k
                self.capacity = new_cap;
1212
0
            }
1213
123k
            Ok(())
1214
        }
1215
123k
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::try_grow
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::try_grow
Line
Count
Source
1177
2.84k
    pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> {
1178
        unsafe {
1179
2.84k
            let unspilled = !self.spilled();
1180
2.84k
            let (ptr, &mut len, cap) = self.triple_mut();
1181
2.84k
            assert!(new_cap >= len);
1182
2.84k
            if new_cap <= Self::inline_capacity() {
1183
0
                if unspilled {
1184
0
                    return Ok(());
1185
0
                }
1186
0
                self.data = SmallVecData::from_inline(MaybeUninit::uninit());
1187
0
                ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len);
1188
0
                self.capacity = len;
1189
0
                deallocate(ptr, cap);
1190
2.84k
            } else if new_cap != cap {
1191
2.84k
                let layout = layout_array::<A::Item>(new_cap)?;
1192
2.84k
                debug_assert!(layout.size() > 0);
1193
                let new_alloc;
1194
2.84k
                if unspilled {
1195
785
                    new_alloc = NonNull::new(alloc::alloc::alloc(layout))
1196
785
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1197
785
                        .cast();
1198
785
                    ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len);
1199
                } else {
1200
                    // This should never fail since the same succeeded
1201
                    // when previously allocating `ptr`.
1202
2.05k
                    let old_layout = layout_array::<A::Item>(cap)?;
1203
1204
2.05k
                    let new_ptr =
1205
2.05k
                        alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size());
1206
2.05k
                    new_alloc = NonNull::new(new_ptr)
1207
2.05k
                        .ok_or(CollectionAllocErr::AllocErr { layout })?
1208
2.05k
                        .cast();
1209
                }
1210
2.84k
                self.data = SmallVecData::from_heap(new_alloc, len);
1211
2.84k
                self.capacity = new_cap;
1212
0
            }
1213
2.84k
            Ok(())
1214
        }
1215
2.84k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::try_grow
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::try_grow
1216
1217
    /// Reserve capacity for `additional` more elements to be inserted.
1218
    ///
1219
    /// May reserve more space to avoid frequent reallocations.
1220
    ///
1221
    /// Panics if the capacity computation overflows `usize`.
1222
    #[inline]
1223
3.46M
    pub fn reserve(&mut self, additional: usize) {
1224
3.46M
        infallible(self.try_reserve(additional))
1225
3.46M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::reserve
Line
Count
Source
1223
6.14k
    pub fn reserve(&mut self, additional: usize) {
1224
6.14k
        infallible(self.try_reserve(additional))
1225
6.14k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::reserve
Line
Count
Source
1223
21.0k
    pub fn reserve(&mut self, additional: usize) {
1224
21.0k
        infallible(self.try_reserve(additional))
1225
21.0k
    }
<smallvec::SmallVec<[u8; 2]>>::reserve
Line
Count
Source
1223
50.8k
    pub fn reserve(&mut self, additional: usize) {
1224
50.8k
        infallible(self.try_reserve(additional))
1225
50.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::reserve
<smallvec::SmallVec<[u8; 256]>>::reserve
Line
Count
Source
1223
430
    pub fn reserve(&mut self, additional: usize) {
1224
430
        infallible(self.try_reserve(additional))
1225
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::reserve
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::reserve
Line
Count
Source
1223
3.35M
    pub fn reserve(&mut self, additional: usize) {
1224
3.35M
        infallible(self.try_reserve(additional))
1225
3.35M
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::reserve
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::reserve
Line
Count
Source
1223
27.4k
    pub fn reserve(&mut self, additional: usize) {
1224
27.4k
        infallible(self.try_reserve(additional))
1225
27.4k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::reserve
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::reserve
1226
1227
    /// Internal method used to grow in push() and insert(), where we know already we have to grow.
1228
    #[cold]
1229
123k
    fn reserve_one_unchecked(&mut self) {
1230
123k
        debug_assert_eq!(self.len(), self.capacity());
1231
123k
        let new_cap = self.len()
1232
123k
            .checked_add(1)
1233
123k
            .and_then(usize::checked_next_power_of_two)
1234
123k
            .expect("capacity overflow");
1235
123k
        infallible(self.try_grow(new_cap))
1236
123k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::reserve_one_unchecked
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::reserve_one_unchecked
Line
Count
Source
1229
18
    fn reserve_one_unchecked(&mut self) {
1230
18
        debug_assert_eq!(self.len(), self.capacity());
1231
18
        let new_cap = self.len()
1232
18
            .checked_add(1)
1233
18
            .and_then(usize::checked_next_power_of_two)
1234
18
            .expect("capacity overflow");
1235
18
        infallible(self.try_grow(new_cap))
1236
18
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 2]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::reserve_one_unchecked
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::reserve_one_unchecked
Line
Count
Source
1229
120k
    fn reserve_one_unchecked(&mut self) {
1230
120k
        debug_assert_eq!(self.len(), self.capacity());
1231
120k
        let new_cap = self.len()
1232
120k
            .checked_add(1)
1233
120k
            .and_then(usize::checked_next_power_of_two)
1234
120k
            .expect("capacity overflow");
1235
120k
        infallible(self.try_grow(new_cap))
1236
120k
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::reserve_one_unchecked
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::reserve_one_unchecked
Line
Count
Source
1229
2.84k
    fn reserve_one_unchecked(&mut self) {
1230
2.84k
        debug_assert_eq!(self.len(), self.capacity());
1231
2.84k
        let new_cap = self.len()
1232
2.84k
            .checked_add(1)
1233
2.84k
            .and_then(usize::checked_next_power_of_two)
1234
2.84k
            .expect("capacity overflow");
1235
2.84k
        infallible(self.try_grow(new_cap))
1236
2.84k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::reserve_one_unchecked
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::reserve_one_unchecked
1237
1238
    /// Reserve capacity for `additional` more elements to be inserted.
1239
    ///
1240
    /// May reserve more space to avoid frequent reallocations.
1241
3.46M
    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1242
        // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
1243
        // calls to it from callers.
1244
3.46M
        let (_, &mut len, cap) = self.triple_mut();
1245
3.46M
        if cap - len >= additional {
1246
3.45M
            return Ok(());
1247
4.23k
        }
1248
4.23k
        let new_cap = len
1249
4.23k
            .checked_add(additional)
1250
4.23k
            .and_then(usize::checked_next_power_of_two)
1251
4.23k
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1252
4.23k
        self.try_grow(new_cap)
1253
3.46M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_reserve
Line
Count
Source
1241
6.14k
    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1242
        // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
1243
        // calls to it from callers.
1244
6.14k
        let (_, &mut len, cap) = self.triple_mut();
1245
6.14k
        if cap - len >= additional {
1246
5.90k
            return Ok(());
1247
242
        }
1248
242
        let new_cap = len
1249
242
            .checked_add(additional)
1250
242
            .and_then(usize::checked_next_power_of_two)
1251
242
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1252
242
        self.try_grow(new_cap)
1253
6.14k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_reserve
Line
Count
Source
1241
21.0k
    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1242
        // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
1243
        // calls to it from callers.
1244
21.0k
        let (_, &mut len, cap) = self.triple_mut();
1245
21.0k
        if cap - len >= additional {
1246
20.0k
            return Ok(());
1247
957
        }
1248
957
        let new_cap = len
1249
957
            .checked_add(additional)
1250
957
            .and_then(usize::checked_next_power_of_two)
1251
957
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1252
957
        self.try_grow(new_cap)
1253
21.0k
    }
<smallvec::SmallVec<[u8; 2]>>::try_reserve
Line
Count
Source
1241
50.8k
    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1242
        // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
1243
        // calls to it from callers.
1244
50.8k
        let (_, &mut len, cap) = self.triple_mut();
1245
50.8k
        if cap - len >= additional {
1246
50.8k
            return Ok(());
1247
0
        }
1248
0
        let new_cap = len
1249
0
            .checked_add(additional)
1250
0
            .and_then(usize::checked_next_power_of_two)
1251
0
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1252
0
        self.try_grow(new_cap)
1253
50.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_reserve
<smallvec::SmallVec<[u8; 256]>>::try_reserve
Line
Count
Source
1241
430
    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1242
        // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
1243
        // calls to it from callers.
1244
430
        let (_, &mut len, cap) = self.triple_mut();
1245
430
        if cap - len >= additional {
1246
430
            return Ok(());
1247
0
        }
1248
0
        let new_cap = len
1249
0
            .checked_add(additional)
1250
0
            .and_then(usize::checked_next_power_of_two)
1251
0
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1252
0
        self.try_grow(new_cap)
1253
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::try_reserve
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::try_reserve
Line
Count
Source
1241
3.35M
    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1242
        // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
1243
        // calls to it from callers.
1244
3.35M
        let (_, &mut len, cap) = self.triple_mut();
1245
3.35M
        if cap - len >= additional {
1246
3.35M
            return Ok(());
1247
3.03k
        }
1248
3.03k
        let new_cap = len
1249
3.03k
            .checked_add(additional)
1250
3.03k
            .and_then(usize::checked_next_power_of_two)
1251
3.03k
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1252
3.03k
        self.try_grow(new_cap)
1253
3.35M
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::try_reserve
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::try_reserve
Line
Count
Source
1241
27.4k
    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1242
        // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated
1243
        // calls to it from callers.
1244
27.4k
        let (_, &mut len, cap) = self.triple_mut();
1245
27.4k
        if cap - len >= additional {
1246
27.4k
            return Ok(());
1247
0
        }
1248
0
        let new_cap = len
1249
0
            .checked_add(additional)
1250
0
            .and_then(usize::checked_next_power_of_two)
1251
0
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1252
0
        self.try_grow(new_cap)
1253
27.4k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::try_reserve
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::try_reserve
1254
1255
    /// Reserve the minimum capacity for `additional` more elements to be inserted.
1256
    ///
1257
    /// Panics if the new capacity overflows `usize`.
1258
430
    pub fn reserve_exact(&mut self, additional: usize) {
1259
430
        infallible(self.try_reserve_exact(additional))
1260
430
    }
1261
1262
    /// Reserve the minimum capacity for `additional` more elements to be inserted.
1263
430
    pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
1264
430
        let (_, &mut len, cap) = self.triple_mut();
1265
430
        if cap - len >= additional {
1266
229
            return Ok(());
1267
201
        }
1268
201
        let new_cap = len
1269
201
            .checked_add(additional)
1270
201
            .ok_or(CollectionAllocErr::CapacityOverflow)?;
1271
201
        self.try_grow(new_cap)
1272
430
    }
1273
1274
    /// Shrink the capacity of the vector as much as possible.
1275
    ///
1276
    /// When possible, this will move data from an external heap buffer to the vector's inline
1277
    /// storage.
1278
    pub fn shrink_to_fit(&mut self) {
1279
        if !self.spilled() {
1280
            return;
1281
        }
1282
        let len = self.len();
1283
        if self.inline_size() >= len {
1284
            unsafe {
1285
                let (ptr, len) = self.data.heap();
1286
                self.data = SmallVecData::from_inline(MaybeUninit::uninit());
1287
                ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len);
1288
                deallocate(ptr.0, self.capacity);
1289
                self.capacity = len;
1290
            }
1291
        } else if self.capacity() > len {
1292
            self.grow(len);
1293
        }
1294
    }
1295
1296
    /// Shorten the vector, keeping the first `len` elements and dropping the rest.
1297
    ///
1298
    /// If `len` is greater than or equal to the vector's current length, this has no
1299
    /// effect.
1300
    ///
1301
    /// This does not re-allocate.  If you want the vector's capacity to shrink, call
1302
    /// `shrink_to_fit` after truncating.
1303
24.2k
    pub fn truncate(&mut self, len: usize) {
1304
        unsafe {
1305
24.2k
            let (ptr, len_ptr, _) = self.triple_mut();
1306
24.2k
            let ptr = ptr.as_ptr();
1307
637k
            while len < *len_ptr {
1308
613k
                let last_index = *len_ptr - 1;
1309
613k
                *len_ptr = last_index;
1310
613k
                ptr::drop_in_place(ptr.add(last_index));
1311
613k
            }
1312
        }
1313
24.2k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::truncate
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::truncate
Line
Count
Source
1303
16.5k
    pub fn truncate(&mut self, len: usize) {
1304
        unsafe {
1305
16.5k
            let (ptr, len_ptr, _) = self.triple_mut();
1306
16.5k
            let ptr = ptr.as_ptr();
1307
630k
            while len < *len_ptr {
1308
613k
                let last_index = *len_ptr - 1;
1309
613k
                *len_ptr = last_index;
1310
613k
                ptr::drop_in_place(ptr.add(last_index));
1311
613k
            }
1312
        }
1313
16.5k
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::truncate
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::truncate
Line
Count
Source
1303
7.71k
    pub fn truncate(&mut self, len: usize) {
1304
        unsafe {
1305
7.71k
            let (ptr, len_ptr, _) = self.triple_mut();
1306
7.71k
            let ptr = ptr.as_ptr();
1307
7.71k
            while len < *len_ptr {
1308
0
                let last_index = *len_ptr - 1;
1309
0
                *len_ptr = last_index;
1310
0
                ptr::drop_in_place(ptr.add(last_index));
1311
0
            }
1312
        }
1313
7.71k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::truncate
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::truncate
1314
1315
    /// Extracts a slice containing the entire vector.
1316
    ///
1317
    /// Equivalent to `&s[..]`.
1318
744k
    pub fn as_slice(&self) -> &[A::Item] {
1319
744k
        self
1320
744k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::as_slice
Line
Count
Source
1318
6.14k
    pub fn as_slice(&self) -> &[A::Item] {
1319
6.14k
        self
1320
6.14k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 2]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::as_slice
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::as_slice
Line
Count
Source
1318
738k
    pub fn as_slice(&self) -> &[A::Item] {
1319
738k
        self
1320
738k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::as_slice
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::as_slice
1321
1322
    /// Extracts a mutable slice of the entire vector.
1323
    ///
1324
    /// Equivalent to `&mut s[..]`.
1325
    pub fn as_mut_slice(&mut self) -> &mut [A::Item] {
1326
        self
1327
    }
1328
1329
    /// Remove the element at position `index`, replacing it with the last element.
1330
    ///
1331
    /// This does not preserve ordering, but is O(1).
1332
    ///
1333
    /// Panics if `index` is out of bounds.
1334
    #[inline]
1335
    pub fn swap_remove(&mut self, index: usize) -> A::Item {
1336
        let len = self.len();
1337
        self.swap(len - 1, index);
1338
        self.pop()
1339
            .unwrap_or_else(|| unsafe { unreachable_unchecked() })
1340
    }
1341
1342
    /// Remove all elements from the vector.
1343
    #[inline]
1344
7.71k
    pub fn clear(&mut self) {
1345
7.71k
        self.truncate(0);
1346
7.71k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::clear
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::clear
Line
Count
Source
1344
7.71k
    pub fn clear(&mut self) {
1345
7.71k
        self.truncate(0);
1346
7.71k
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::clear
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::clear
1347
1348
    /// Remove and return the element at position `index`, shifting all elements after it to the
1349
    /// left.
1350
    ///
1351
    /// Panics if `index` is out of bounds.
1352
    pub fn remove(&mut self, index: usize) -> A::Item {
1353
        unsafe {
1354
            let (ptr, len_ptr, _) = self.triple_mut();
1355
            let len = *len_ptr;
1356
            assert!(index < len);
1357
            *len_ptr = len - 1;
1358
            let ptr = ptr.as_ptr().add(index);
1359
            let item = ptr::read(ptr);
1360
            ptr::copy(ptr.add(1), ptr, len - index - 1);
1361
            item
1362
        }
1363
    }
1364
1365
    /// Insert an element at position `index`, shifting all elements after it to the right.
1366
    ///
1367
    /// Panics if `index > len`.
1368
    pub fn insert(&mut self, index: usize, element: A::Item) {
1369
        unsafe {
1370
            let (mut ptr, mut len_ptr, cap) = self.triple_mut();
1371
            if *len_ptr == cap {
1372
                self.reserve_one_unchecked();
1373
                let (heap_ptr, heap_len_ptr) = self.data.heap_mut();
1374
                ptr = heap_ptr;
1375
                len_ptr = heap_len_ptr;
1376
            }
1377
            let mut ptr = ptr.as_ptr();
1378
            let len = *len_ptr;
1379
            if index > len {
1380
                panic!("index exceeds length");
1381
            }
1382
            // SAFETY: add is UB if index > len, but we panicked first
1383
            ptr = ptr.add(index);
1384
            if index < len {
1385
                // Shift element to the right of `index`.
1386
                ptr::copy(ptr, ptr.add(1), len - index);
1387
            }
1388
            *len_ptr = len + 1;
1389
            ptr::write(ptr, element);
1390
        }
1391
    }
1392
1393
    /// Insert multiple elements at position `index`, shifting all following elements toward the
1394
    /// back.
1395
    pub fn insert_many<I: IntoIterator<Item = A::Item>>(&mut self, index: usize, iterable: I) {
1396
        let mut iter = iterable.into_iter();
1397
        if index == self.len() {
1398
            return self.extend(iter);
1399
        }
1400
1401
        let (lower_size_bound, _) = iter.size_hint();
1402
        assert!(lower_size_bound <= core::isize::MAX as usize); // Ensure offset is indexable
1403
        assert!(index + lower_size_bound >= index); // Protect against overflow
1404
1405
        let mut num_added = 0;
1406
        let old_len = self.len();
1407
        assert!(index <= old_len);
1408
1409
        unsafe {
1410
            // Reserve space for `lower_size_bound` elements.
1411
            self.reserve(lower_size_bound);
1412
            let start = self.as_mut_ptr();
1413
            let ptr = start.add(index);
1414
1415
            // Move the trailing elements.
1416
            ptr::copy(ptr, ptr.add(lower_size_bound), old_len - index);
1417
1418
            // In case the iterator panics, don't double-drop the items we just copied above.
1419
            self.set_len(0);
1420
            let mut guard = DropOnPanic {
1421
                start,
1422
                skip: index..(index + lower_size_bound),
1423
                len: old_len + lower_size_bound,
1424
            };
1425
1426
            // The set_len above invalidates the previous pointers, so we must re-create them.
1427
            let start = self.as_mut_ptr();
1428
            let ptr = start.add(index);
1429
1430
            while num_added < lower_size_bound {
1431
                let element = match iter.next() {
1432
                    Some(x) => x,
1433
                    None => break,
1434
                };
1435
                let cur = ptr.add(num_added);
1436
                ptr::write(cur, element);
1437
                guard.skip.start += 1;
1438
                num_added += 1;
1439
            }
1440
1441
            if num_added < lower_size_bound {
1442
                // Iterator provided fewer elements than the hint. Move the tail backward.
1443
                ptr::copy(
1444
                    ptr.add(lower_size_bound),
1445
                    ptr.add(num_added),
1446
                    old_len - index,
1447
                );
1448
            }
1449
            // There are no more duplicate or uninitialized slots, so the guard is not needed.
1450
            self.set_len(old_len + num_added);
1451
            mem::forget(guard);
1452
        }
1453
1454
        // Insert any remaining elements one-by-one.
1455
        for element in iter {
1456
            self.insert(index + num_added, element);
1457
            num_added += 1;
1458
        }
1459
1460
        struct DropOnPanic<T> {
1461
            start: *mut T,
1462
            skip: Range<usize>, // Space we copied-out-of, but haven't written-to yet.
1463
            len: usize,
1464
        }
1465
1466
        impl<T> Drop for DropOnPanic<T> {
1467
            fn drop(&mut self) {
1468
                for i in 0..self.len {
1469
                    if !self.skip.contains(&i) {
1470
                        unsafe {
1471
                            ptr::drop_in_place(self.start.add(i));
1472
                        }
1473
                    }
1474
                }
1475
            }
1476
        }
1477
    }
1478
1479
    /// Convert a `SmallVec` to a `Vec`, without reallocating if the `SmallVec` has already spilled onto
1480
    /// the heap.
1481
    pub fn into_vec(mut self) -> Vec<A::Item> {
1482
        if self.spilled() {
1483
            unsafe {
1484
                let (ptr, &mut len) = self.data.heap_mut();
1485
                let v = Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity);
1486
                mem::forget(self);
1487
                v
1488
            }
1489
        } else {
1490
            self.into_iter().collect()
1491
        }
1492
    }
1493
1494
    /// Converts a `SmallVec` into a `Box<[T]>` without reallocating if the `SmallVec` has already spilled
1495
    /// onto the heap.
1496
    ///
1497
    /// Note that this will drop any excess capacity.
1498
    pub fn into_boxed_slice(self) -> Box<[A::Item]> {
1499
        self.into_vec().into_boxed_slice()
1500
    }
1501
1502
    /// Convert the `SmallVec` into an `A` if possible. Otherwise return `Err(Self)`.
1503
    ///
1504
    /// This method returns `Err(Self)` if the `SmallVec` is too short (and the `A` contains uninitialized elements),
1505
    /// or if the `SmallVec` is too long (and all the elements were spilled to the heap).
1506
    pub fn into_inner(self) -> Result<A, Self> {
1507
        if self.spilled() || self.len() != A::size() {
1508
            // Note: A::size, not Self::inline_capacity
1509
            Err(self)
1510
        } else {
1511
            unsafe {
1512
                let data = ptr::read(&self.data);
1513
                mem::forget(self);
1514
                Ok(data.into_inline().assume_init())
1515
            }
1516
        }
1517
    }
1518
1519
    /// Retains only the elements specified by the predicate.
1520
    ///
1521
    /// In other words, remove all elements `e` such that `f(&e)` returns `false`.
1522
    /// This method operates in place and preserves the order of the retained
1523
    /// elements.
1524
    pub fn retain<F: FnMut(&mut A::Item) -> bool>(&mut self, mut f: F) {
1525
        let mut del = 0;
1526
        let len = self.len();
1527
        for i in 0..len {
1528
            if !f(&mut self[i]) {
1529
                del += 1;
1530
            } else if del > 0 {
1531
                self.swap(i - del, i);
1532
            }
1533
        }
1534
        self.truncate(len - del);
1535
    }
1536
1537
    /// Retains only the elements specified by the predicate.
1538
    ///
1539
    /// This method is identical in behaviour to [`retain`]; it is included only
1540
    /// to maintain api-compatibility with `std::Vec`, where the methods are
1541
    /// separate for historical reasons.
1542
    pub fn retain_mut<F: FnMut(&mut A::Item) -> bool>(&mut self, f: F) {
1543
        self.retain(f)
1544
    }
1545
1546
    /// Removes consecutive duplicate elements.
1547
    pub fn dedup(&mut self)
1548
    where
1549
        A::Item: PartialEq<A::Item>,
1550
    {
1551
        self.dedup_by(|a, b| a == b);
1552
    }
1553
1554
    /// Removes consecutive duplicate elements using the given equality relation.
1555
    pub fn dedup_by<F>(&mut self, mut same_bucket: F)
1556
    where
1557
        F: FnMut(&mut A::Item, &mut A::Item) -> bool,
1558
    {
1559
        // See the implementation of Vec::dedup_by in the
1560
        // standard library for an explanation of this algorithm.
1561
        let len = self.len();
1562
        if len <= 1 {
1563
            return;
1564
        }
1565
1566
        let ptr = self.as_mut_ptr();
1567
        let mut w: usize = 1;
1568
1569
        unsafe {
1570
            for r in 1..len {
1571
                let p_r = ptr.add(r);
1572
                let p_wm1 = ptr.add(w - 1);
1573
                if !same_bucket(&mut *p_r, &mut *p_wm1) {
1574
                    if r != w {
1575
                        let p_w = p_wm1.add(1);
1576
                        mem::swap(&mut *p_r, &mut *p_w);
1577
                    }
1578
                    w += 1;
1579
                }
1580
            }
1581
        }
1582
1583
        self.truncate(w);
1584
    }
1585
1586
    /// Removes consecutive elements that map to the same key.
1587
    pub fn dedup_by_key<F, K>(&mut self, mut key: F)
1588
    where
1589
        F: FnMut(&mut A::Item) -> K,
1590
        K: PartialEq<K>,
1591
    {
1592
        self.dedup_by(|a, b| key(a) == key(b));
1593
    }
1594
1595
    /// Resizes the `SmallVec` in-place so that `len` is equal to `new_len`.
1596
    ///
1597
    /// If `new_len` is greater than `len`, the `SmallVec` is extended by the difference, with each
1598
    /// additional slot filled with the result of calling the closure `f`. The return values from `f`
1599
    /// will end up in the `SmallVec` in the order they have been generated.
1600
    ///
1601
    /// If `new_len` is less than `len`, the `SmallVec` is simply truncated.
1602
    ///
1603
    /// This method uses a closure to create new values on every push. If you'd rather `Clone` a given
1604
    /// value, use `resize`. If you want to use the `Default` trait to generate values, you can pass
1605
    /// `Default::default()` as the second argument.
1606
    ///
1607
    /// Added for `std::vec::Vec` compatibility (added in Rust 1.33.0)
1608
    ///
1609
    /// ```
1610
    /// # use smallvec::{smallvec, SmallVec};
1611
    /// let mut vec : SmallVec<[_; 4]> = smallvec![1, 2, 3];
1612
    /// vec.resize_with(5, Default::default);
1613
    /// assert_eq!(&*vec, &[1, 2, 3, 0, 0]);
1614
    ///
1615
    /// let mut vec : SmallVec<[_; 4]> = smallvec![];
1616
    /// let mut p = 1;
1617
    /// vec.resize_with(4, || { p *= 2; p });
1618
    /// assert_eq!(&*vec, &[2, 4, 8, 16]);
1619
    /// ```
1620
    pub fn resize_with<F>(&mut self, new_len: usize, f: F)
1621
    where
1622
        F: FnMut() -> A::Item,
1623
    {
1624
        let old_len = self.len();
1625
        if old_len < new_len {
1626
            let mut f = f;
1627
            let additional = new_len - old_len;
1628
            self.reserve(additional);
1629
            for _ in 0..additional {
1630
                self.push(f());
1631
            }
1632
        } else if old_len > new_len {
1633
            self.truncate(new_len);
1634
        }
1635
    }
1636
1637
    /// Creates a `SmallVec` directly from the raw components of another
1638
    /// `SmallVec`.
1639
    ///
1640
    /// # Safety
1641
    ///
1642
    /// This is highly unsafe, due to the number of invariants that aren't
1643
    /// checked:
1644
    ///
1645
    /// * `ptr` needs to have been previously allocated via `SmallVec` for its
1646
    ///   spilled storage (at least, it's highly likely to be incorrect if it
1647
    ///   wasn't).
1648
    /// * `ptr`'s `A::Item` type needs to be the same size and alignment that
1649
    ///   it was allocated with
1650
    /// * `length` needs to be less than or equal to `capacity`.
1651
    /// * `capacity` needs to be the capacity that the pointer was allocated
1652
    ///   with.
1653
    ///
1654
    /// Violating these may cause problems like corrupting the allocator's
1655
    /// internal data structures.
1656
    ///
1657
    /// Additionally, `capacity` must be greater than the amount of inline
1658
    /// storage `A` has; that is, the new `SmallVec` must need to spill over
1659
    /// into heap allocated storage. This condition is asserted against.
1660
    ///
1661
    /// The ownership of `ptr` is effectively transferred to the
1662
    /// `SmallVec` which may then deallocate, reallocate or change the
1663
    /// contents of memory pointed to by the pointer at will. Ensure
1664
    /// that nothing else uses the pointer after calling this
1665
    /// function.
1666
    ///
1667
    /// # Examples
1668
    ///
1669
    /// ```
1670
    /// # use smallvec::{smallvec, SmallVec};
1671
    /// use std::mem;
1672
    /// use std::ptr;
1673
    ///
1674
    /// fn main() {
1675
    ///     let mut v: SmallVec<[_; 1]> = smallvec![1, 2, 3];
1676
    ///
1677
    ///     // Pull out the important parts of `v`.
1678
    ///     let p = v.as_mut_ptr();
1679
    ///     let len = v.len();
1680
    ///     let cap = v.capacity();
1681
    ///     let spilled = v.spilled();
1682
    ///
1683
    ///     unsafe {
1684
    ///         // Forget all about `v`. The heap allocation that stored the
1685
    ///         // three values won't be deallocated.
1686
    ///         mem::forget(v);
1687
    ///
1688
    ///         // Overwrite memory with [4, 5, 6].
1689
    ///         //
1690
    ///         // This is only safe if `spilled` is true! Otherwise, we are
1691
    ///         // writing into the old `SmallVec`'s inline storage on the
1692
    ///         // stack.
1693
    ///         assert!(spilled);
1694
    ///         for i in 0..len {
1695
    ///             ptr::write(p.add(i), 4 + i);
1696
    ///         }
1697
    ///
1698
    ///         // Put everything back together into a SmallVec with a different
1699
    ///         // amount of inline storage, but which is still less than `cap`.
1700
    ///         let rebuilt = SmallVec::<[_; 2]>::from_raw_parts(p, len, cap);
1701
    ///         assert_eq!(&*rebuilt, &[4, 5, 6]);
1702
    ///     }
1703
    /// }
1704
    #[inline]
1705
    pub unsafe fn from_raw_parts(ptr: *mut A::Item, length: usize, capacity: usize) -> SmallVec<A> {
1706
        // SAFETY: We require caller to provide same ptr as we alloc
1707
        // and we never alloc null pointer.
1708
        let ptr = unsafe {
1709
            debug_assert!(!ptr.is_null(), "Called `from_raw_parts` with null pointer.");
1710
            NonNull::new_unchecked(ptr)
1711
        };
1712
        assert!(capacity > Self::inline_capacity());
1713
        SmallVec {
1714
            capacity,
1715
            data: SmallVecData::from_heap(ptr, length),
1716
        }
1717
    }
1718
1719
    /// Returns a raw pointer to the vector's buffer.
1720
7.51M
    pub fn as_ptr(&self) -> *const A::Item {
1721
        // We shadow the slice method of the same name to avoid going through
1722
        // `deref`, which creates an intermediate reference that may place
1723
        // additional safety constraints on the contents of the slice.
1724
7.51M
        self.triple().0.as_ptr()
1725
7.51M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::as_ptr
Line
Count
Source
1720
7.51M
    pub fn as_ptr(&self) -> *const A::Item {
1721
        // We shadow the slice method of the same name to avoid going through
1722
        // `deref`, which creates an intermediate reference that may place
1723
        // additional safety constraints on the contents of the slice.
1724
7.51M
        self.triple().0.as_ptr()
1725
7.51M
    }
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::as_ptr
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::as_ptr
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::as_ptr
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::as_ptr
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::as_ptr
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::as_ptr
1726
1727
    /// Returns a raw mutable pointer to the vector's buffer.
1728
430
    pub fn as_mut_ptr(&mut self) -> *mut A::Item {
1729
        // We shadow the slice method of the same name to avoid going through
1730
        // `deref_mut`, which creates an intermediate reference that may place
1731
        // additional safety constraints on the contents of the slice.
1732
430
        self.triple_mut().0.as_ptr()
1733
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_mut_ptr
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_mut_ptr
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_mut_ptr
<smallvec::SmallVec<[u8; 256]>>::as_mut_ptr
Line
Count
Source
1728
430
    pub fn as_mut_ptr(&mut self) -> *mut A::Item {
1729
        // We shadow the slice method of the same name to avoid going through
1730
        // `deref_mut`, which creates an intermediate reference that may place
1731
        // additional safety constraints on the contents of the slice.
1732
430
        self.triple_mut().0.as_ptr()
1733
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::as_mut_ptr
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr
1734
}
1735
1736
impl<A: Array> SmallVec<A>
1737
where
1738
    A::Item: Copy,
1739
{
1740
    /// Copy the elements from a slice into a new `SmallVec`.
1741
    ///
1742
    /// For slices of `Copy` types, this is more efficient than `SmallVec::from(slice)`.
1743
    pub fn from_slice(slice: &[A::Item]) -> Self {
1744
        let len = slice.len();
1745
        if len <= Self::inline_capacity() {
1746
            SmallVec {
1747
                capacity: len,
1748
                data: SmallVecData::from_inline(unsafe {
1749
                    let mut data: MaybeUninit<A> = MaybeUninit::uninit();
1750
                    ptr::copy_nonoverlapping(
1751
                        slice.as_ptr(),
1752
                        data.as_mut_ptr() as *mut A::Item,
1753
                        len,
1754
                    );
1755
                    data
1756
                }),
1757
            }
1758
        } else {
1759
            let mut b = slice.to_vec();
1760
            let cap = b.capacity();
1761
            let ptr = NonNull::new(b.as_mut_ptr()).expect("Vec always contain non null pointers.");
1762
            mem::forget(b);
1763
            SmallVec {
1764
                capacity: cap,
1765
                data: SmallVecData::from_heap(ptr, len),
1766
            }
1767
        }
1768
    }
1769
1770
    /// Copy elements from a slice into the vector at position `index`, shifting any following
1771
    /// elements toward the back.
1772
    ///
1773
    /// For slices of `Copy` types, this is more efficient than `insert`.
1774
    #[inline]
1775
430
    pub fn insert_from_slice(&mut self, index: usize, slice: &[A::Item]) {
1776
430
        self.reserve(slice.len());
1777
1778
430
        let len = self.len();
1779
430
        assert!(index <= len);
1780
1781
430
        unsafe {
1782
430
            let slice_ptr = slice.as_ptr();
1783
430
            let ptr = self.as_mut_ptr().add(index);
1784
430
            ptr::copy(ptr, ptr.add(slice.len()), len - index);
1785
430
            ptr::copy_nonoverlapping(slice_ptr, ptr, slice.len());
1786
430
            self.set_len(len + slice.len());
1787
430
        }
1788
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::insert_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::insert_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::insert_from_slice
<smallvec::SmallVec<[u8; 256]>>::insert_from_slice
Line
Count
Source
1775
430
    pub fn insert_from_slice(&mut self, index: usize, slice: &[A::Item]) {
1776
430
        self.reserve(slice.len());
1777
1778
430
        let len = self.len();
1779
430
        assert!(index <= len);
1780
1781
430
        unsafe {
1782
430
            let slice_ptr = slice.as_ptr();
1783
430
            let ptr = self.as_mut_ptr().add(index);
1784
430
            ptr::copy(ptr, ptr.add(slice.len()), len - index);
1785
430
            ptr::copy_nonoverlapping(slice_ptr, ptr, slice.len());
1786
430
            self.set_len(len + slice.len());
1787
430
        }
1788
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::insert_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice
1789
1790
    /// Copy elements from a slice and append them to the vector.
1791
    ///
1792
    /// For slices of `Copy` types, this is more efficient than `extend`.
1793
    #[inline]
1794
430
    pub fn extend_from_slice(&mut self, slice: &[A::Item]) {
1795
430
        let len = self.len();
1796
430
        self.insert_from_slice(len, slice);
1797
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::extend_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::extend_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::extend_from_slice
<smallvec::SmallVec<[u8; 256]>>::extend_from_slice
Line
Count
Source
1794
430
    pub fn extend_from_slice(&mut self, slice: &[A::Item]) {
1795
430
        let len = self.len();
1796
430
        self.insert_from_slice(len, slice);
1797
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]>>::extend_from_slice
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice
1798
}
1799
1800
impl<A: Array> SmallVec<A>
1801
where
1802
    A::Item: Clone,
1803
{
1804
    /// Resizes the vector so that its length is equal to `len`.
1805
    ///
1806
    /// If `len` is less than the current length, the vector simply truncated.
1807
    ///
1808
    /// If `len` is greater than the current length, `value` is appended to the
1809
    /// vector until its length equals `len`.
1810
    pub fn resize(&mut self, len: usize, value: A::Item) {
1811
        let old_len = self.len();
1812
1813
        if len > old_len {
1814
            self.extend(repeat(value).take(len - old_len));
1815
        } else {
1816
            self.truncate(len);
1817
        }
1818
    }
1819
1820
    /// Creates a `SmallVec` with `n` copies of `elem`.
1821
    /// ```
1822
    /// use smallvec::SmallVec;
1823
    ///
1824
    /// let v = SmallVec::<[char; 128]>::from_elem('d', 2);
1825
    /// assert_eq!(v, SmallVec::from_buf(['d', 'd']));
1826
    /// ```
1827
    pub fn from_elem(elem: A::Item, n: usize) -> Self {
1828
        if n > Self::inline_capacity() {
1829
            vec![elem; n].into()
1830
        } else {
1831
            let mut v = SmallVec::<A>::new();
1832
            unsafe {
1833
                let (ptr, len_ptr, _) = v.triple_mut();
1834
                let ptr = ptr.as_ptr();
1835
                let mut local_len = SetLenOnDrop::new(len_ptr);
1836
1837
                for i in 0..n {
1838
                    ::core::ptr::write(ptr.add(i), elem.clone());
1839
                    local_len.increment_len(1);
1840
                }
1841
            }
1842
            v
1843
        }
1844
    }
1845
}
1846
1847
impl<A: Array> ops::Deref for SmallVec<A> {
1848
    type Target = [A::Item];
1849
    #[inline]
1850
3.47M
    fn deref(&self) -> &[A::Item] {
1851
        unsafe {
1852
3.47M
            let (ptr, len, _) = self.triple();
1853
3.47M
            slice::from_raw_parts(ptr.as_ptr(), len)
1854
        }
1855
3.47M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::Deref>::deref
Line
Count
Source
1850
6.14k
    fn deref(&self) -> &[A::Item] {
1851
        unsafe {
1852
6.14k
            let (ptr, len, _) = self.triple();
1853
6.14k
            slice::from_raw_parts(ptr.as_ptr(), len)
1854
        }
1855
6.14k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::Deref>::deref
Line
Count
Source
1850
73.1k
    fn deref(&self) -> &[A::Item] {
1851
        unsafe {
1852
73.1k
            let (ptr, len, _) = self.triple();
1853
73.1k
            slice::from_raw_parts(ptr.as_ptr(), len)
1854
        }
1855
73.1k
    }
<smallvec::SmallVec<[u8; 2]> as core::ops::deref::Deref>::deref
Line
Count
Source
1850
65.8k
    fn deref(&self) -> &[A::Item] {
1851
        unsafe {
1852
65.8k
            let (ptr, len, _) = self.triple();
1853
65.8k
            slice::from_raw_parts(ptr.as_ptr(), len)
1854
        }
1855
65.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::Deref>::deref
<smallvec::SmallVec<[u8; 256]> as core::ops::deref::Deref>::deref
Line
Count
Source
1850
860
    fn deref(&self) -> &[A::Item] {
1851
        unsafe {
1852
860
            let (ptr, len, _) = self.triple();
1853
860
            slice::from_raw_parts(ptr.as_ptr(), len)
1854
        }
1855
860
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::Deref>::deref
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::Deref>::deref
Line
Count
Source
1850
3.32M
    fn deref(&self) -> &[A::Item] {
1851
        unsafe {
1852
3.32M
            let (ptr, len, _) = self.triple();
1853
3.32M
            slice::from_raw_parts(ptr.as_ptr(), len)
1854
        }
1855
3.32M
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::Deref>::deref
1856
}
1857
1858
impl<A: Array> ops::DerefMut for SmallVec<A> {
1859
    #[inline]
1860
6.75M
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
6.75M
        unsafe {
1862
6.75M
            let (ptr, &mut len, _) = self.triple_mut();
1863
6.75M
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
6.75M
        }
1865
6.75M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
24.2k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
24.2k
        unsafe {
1862
24.2k
            let (ptr, &mut len, _) = self.triple_mut();
1863
24.2k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
24.2k
        }
1865
24.2k
    }
<smallvec::SmallVec<[u8; 2]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
44.7k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
44.7k
        unsafe {
1862
44.7k
            let (ptr, &mut len, _) = self.triple_mut();
1863
44.7k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
44.7k
        }
1865
44.7k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
31.9k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
31.9k
        unsafe {
1862
31.9k
            let (ptr, &mut len, _) = self.triple_mut();
1863
31.9k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
31.9k
        }
1865
31.9k
    }
<smallvec::SmallVec<[u8; 2]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
6.14k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
6.14k
        unsafe {
1862
6.14k
            let (ptr, &mut len, _) = self.triple_mut();
1863
6.14k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
6.14k
        }
1865
6.14k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]> as core::ops::deref::DerefMut>::deref_mut
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
6.53k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
6.53k
        unsafe {
1862
6.53k
            let (ptr, &mut len, _) = self.triple_mut();
1863
6.53k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
6.53k
        }
1865
6.53k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
187
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
187
        unsafe {
1862
187
            let (ptr, &mut len, _) = self.triple_mut();
1863
187
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
187
        }
1865
187
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
<smallvec::SmallVec<[u8; 256]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
659
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
659
        unsafe {
1862
659
            let (ptr, &mut len, _) = self.triple_mut();
1863
659
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
659
        }
1865
659
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
4.00M
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
4.00M
        unsafe {
1862
4.00M
            let (ptr, &mut len, _) = self.triple_mut();
1863
4.00M
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
4.00M
        }
1865
4.00M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
7.71k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
7.71k
        unsafe {
1862
7.71k
            let (ptr, &mut len, _) = self.triple_mut();
1863
7.71k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
7.71k
        }
1865
7.71k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
6.93k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
6.93k
        unsafe {
1862
6.93k
            let (ptr, &mut len, _) = self.triple_mut();
1863
6.93k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
6.93k
        }
1865
6.93k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
2.61M
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
2.61M
        unsafe {
1862
2.61M
            let (ptr, &mut len, _) = self.triple_mut();
1863
2.61M
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
2.61M
        }
1865
2.61M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
Line
Count
Source
1860
5.26k
    fn deref_mut(&mut self) -> &mut [A::Item] {
1861
5.26k
        unsafe {
1862
5.26k
            let (ptr, &mut len, _) = self.triple_mut();
1863
5.26k
            slice::from_raw_parts_mut(ptr.as_ptr(), len)
1864
5.26k
        }
1865
5.26k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::deref::DerefMut>::deref_mut
1866
}
1867
1868
impl<A: Array> AsRef<[A::Item]> for SmallVec<A> {
1869
    #[inline]
1870
21.9k
    fn as_ref(&self) -> &[A::Item] {
1871
21.9k
        self
1872
21.9k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::convert::AsRef<[gix_config::parse::Event]>>::as_ref
Line
Count
Source
1870
13.4k
    fn as_ref(&self) -> &[A::Item] {
1871
13.4k
        self
1872
13.4k
    }
<smallvec::SmallVec<[u8; 2]> as core::convert::AsRef<[u8]>>::as_ref
Line
Count
Source
1870
8.44k
    fn as_ref(&self) -> &[A::Item] {
1871
8.44k
        self
1872
8.44k
    }
1873
}
1874
1875
impl<A: Array> AsMut<[A::Item]> for SmallVec<A> {
1876
    #[inline]
1877
    fn as_mut(&mut self) -> &mut [A::Item] {
1878
        self
1879
    }
1880
}
1881
1882
impl<A: Array> Borrow<[A::Item]> for SmallVec<A> {
1883
    #[inline]
1884
    fn borrow(&self) -> &[A::Item] {
1885
        self
1886
    }
1887
}
1888
1889
impl<A: Array> BorrowMut<[A::Item]> for SmallVec<A> {
1890
    #[inline]
1891
    fn borrow_mut(&mut self) -> &mut [A::Item] {
1892
        self
1893
    }
1894
}
1895
1896
#[cfg(feature = "write")]
1897
#[cfg_attr(docsrs, doc(cfg(feature = "write")))]
1898
impl<A: Array<Item = u8>> io::Write for SmallVec<A> {
1899
    #[inline]
1900
0
    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
1901
0
        self.extend_from_slice(buf);
1902
0
        Ok(buf.len())
1903
0
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write
1904
1905
    #[inline]
1906
0
    fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
1907
0
        self.extend_from_slice(buf);
1908
0
        Ok(())
1909
0
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write_all
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write_all
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write_all
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::write_all
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all
1910
1911
    #[inline]
1912
0
    fn flush(&mut self) -> io::Result<()> {
1913
0
        Ok(())
1914
0
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::flush
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::flush
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::flush
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as std::io::Write>::flush
1915
}
1916
1917
#[cfg(feature = "serde")]
1918
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
1919
impl<A: Array> Serialize for SmallVec<A>
1920
where
1921
    A::Item: Serialize,
1922
{
1923
    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1924
        let mut state = serializer.serialize_seq(Some(self.len()))?;
1925
        for item in self {
1926
            state.serialize_element(&item)?;
1927
        }
1928
        state.end()
1929
    }
1930
}
1931
1932
#[cfg(feature = "serde")]
1933
#[cfg_attr(docsrs, doc(cfg(feature = "serde")))]
1934
impl<'de, A: Array> Deserialize<'de> for SmallVec<A>
1935
where
1936
    A::Item: Deserialize<'de>,
1937
{
1938
    fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1939
        deserializer.deserialize_seq(SmallVecVisitor {
1940
            phantom: PhantomData,
1941
        })
1942
    }
1943
}
1944
1945
#[cfg(feature = "serde")]
1946
struct SmallVecVisitor<A> {
1947
    phantom: PhantomData<A>,
1948
}
1949
1950
#[cfg(feature = "serde")]
1951
impl<'de, A: Array> Visitor<'de> for SmallVecVisitor<A>
1952
where
1953
    A::Item: Deserialize<'de>,
1954
{
1955
    type Value = SmallVec<A>;
1956
1957
    fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
1958
        formatter.write_str("a sequence")
1959
    }
1960
1961
    fn visit_seq<B>(self, mut seq: B) -> Result<Self::Value, B::Error>
1962
    where
1963
        B: SeqAccess<'de>,
1964
    {
1965
        use serde::de::Error;
1966
        let len = seq.size_hint().unwrap_or(0);
1967
        let mut values = SmallVec::new();
1968
        values.try_reserve(len).map_err(B::Error::custom)?;
1969
1970
        while let Some(value) = seq.next_element()? {
1971
            values.push(value);
1972
        }
1973
1974
        Ok(values)
1975
    }
1976
}
1977
1978
#[cfg(feature = "malloc_size_of")]
1979
impl<A: Array> MallocShallowSizeOf for SmallVec<A> {
1980
    fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
1981
        if self.spilled() {
1982
            unsafe { ops.malloc_size_of(self.as_ptr()) }
1983
        } else {
1984
            0
1985
        }
1986
    }
1987
}
1988
1989
#[cfg(feature = "malloc_size_of")]
1990
impl<A> MallocSizeOf for SmallVec<A>
1991
where
1992
    A: Array,
1993
    A::Item: MallocSizeOf,
1994
{
1995
    fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
1996
        let mut n = self.shallow_size_of(ops);
1997
        for elem in self.iter() {
1998
            n += elem.size_of(ops);
1999
        }
2000
        n
2001
    }
2002
}
2003
2004
#[cfg(feature = "specialization")]
2005
trait SpecFrom<A: Array, S> {
2006
    fn spec_from(slice: S) -> SmallVec<A>;
2007
}
2008
2009
#[cfg(feature = "specialization")]
2010
mod specialization;
2011
2012
#[cfg(feature = "arbitrary")]
2013
mod arbitrary;
2014
2015
#[cfg(feature = "specialization")]
2016
impl<'a, A: Array> SpecFrom<A, &'a [A::Item]> for SmallVec<A>
2017
where
2018
    A::Item: Copy,
2019
{
2020
    #[inline]
2021
    fn spec_from(slice: &'a [A::Item]) -> SmallVec<A> {
2022
        SmallVec::from_slice(slice)
2023
    }
2024
}
2025
2026
impl<'a, A: Array> From<&'a [A::Item]> for SmallVec<A>
2027
where
2028
    A::Item: Clone,
2029
{
2030
    #[cfg(not(feature = "specialization"))]
2031
    #[inline]
2032
795k
    fn from(slice: &'a [A::Item]) -> SmallVec<A> {
2033
795k
        slice.iter().cloned().collect()
2034
795k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::convert::From<&[gix_config::parse::Event]>>::from
Line
Count
Source
2032
6.14k
    fn from(slice: &'a [A::Item]) -> SmallVec<A> {
2033
6.14k
        slice.iter().cloned().collect()
2034
6.14k
    }
<smallvec::SmallVec<[u8; 2]> as core::convert::From<&[u8]>>::from
Line
Count
Source
2032
50.8k
    fn from(slice: &'a [A::Item]) -> SmallVec<A> {
2033
50.8k
        slice.iter().cloned().collect()
2034
50.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<&[&bstr::bstr::BStr]>>::from
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<&[&bstr::bstr::BStr]>>::from
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<&[&bstr::bstr::BStr]>>::from
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::convert::From<&[gix_hash::object_id::ObjectId]>>::from
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::convert::From<&[u8]>>::from
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<&[&bstr::bstr::BStr]>>::from
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::convert::From<&[gix_attributes::search::TrackedAssignment]>>::from
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::convert::From<&[gix_attributes::search::TrackedAssignment]>>::from
Line
Count
Source
2032
738k
    fn from(slice: &'a [A::Item]) -> SmallVec<A> {
2033
738k
        slice.iter().cloned().collect()
2034
738k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::convert::From<&[gix_hash::object_id::ObjectId]>>::from
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::convert::From<&[gix_attributes::search::TrackedAssignment]>>::from
2035
2036
    #[cfg(feature = "specialization")]
2037
    #[inline]
2038
    fn from(slice: &'a [A::Item]) -> SmallVec<A> {
2039
        SmallVec::spec_from(slice)
2040
    }
2041
}
2042
2043
impl<A: Array> From<Vec<A::Item>> for SmallVec<A> {
2044
    #[inline]
2045
201
    fn from(vec: Vec<A::Item>) -> SmallVec<A> {
2046
201
        SmallVec::from_vec(vec)
2047
201
    }
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<alloc::vec::Vec<&bstr::bstr::BStr>>>::from
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<alloc::vec::Vec<&bstr::bstr::BStr>>>::from
Line
Count
Source
2045
201
    fn from(vec: Vec<A::Item>) -> SmallVec<A> {
2046
201
        SmallVec::from_vec(vec)
2047
201
    }
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<alloc::vec::Vec<&bstr::bstr::BStr>>>::from
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::convert::From<alloc::vec::Vec<&bstr::bstr::BStr>>>::from
2048
}
2049
2050
impl<A: Array> From<A> for SmallVec<A> {
2051
    #[inline]
2052
    fn from(array: A) -> SmallVec<A> {
2053
        SmallVec::from_buf(array)
2054
    }
2055
}
2056
2057
impl<A: Array, I: SliceIndex<[A::Item]>> ops::Index<I> for SmallVec<A> {
2058
    type Output = I::Output;
2059
2060
0
    fn index(&self, index: I) -> &I::Output {
2061
0
        &(**self)[index]
2062
0
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::ops::index::Index<core::ops::range::RangeFull>>::index
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]> as core::ops::index::Index<usize>>::index
2063
}
2064
2065
impl<A: Array, I: SliceIndex<[A::Item]>> ops::IndexMut<I> for SmallVec<A> {
2066
4.16M
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
4.16M
        &mut (&mut **self)[index]
2068
4.16M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
24.2k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
24.2k
        &mut (&mut **self)[index]
2068
24.2k
    }
<smallvec::SmallVec<[u8; 2]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
44.7k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
44.7k
        &mut (&mut **self)[index]
2068
44.7k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
31.9k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
31.9k
        &mut (&mut **self)[index]
2068
31.9k
    }
<smallvec::SmallVec<[u8; 2]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
6.14k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
6.14k
        &mut (&mut **self)[index]
2068
6.14k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
6.53k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
6.53k
        &mut (&mut **self)[index]
2068
6.53k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
187
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
187
        &mut (&mut **self)[index]
2068
187
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
<smallvec::SmallVec<[u8; 256]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
229
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
229
        &mut (&mut **self)[index]
2068
229
    }
<smallvec::SmallVec<[u8; 256]> as core::ops::index::IndexMut<usize>>::index_mut
Line
Count
Source
2066
430
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
430
        &mut (&mut **self)[index]
2068
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
4.00M
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
4.00M
        &mut (&mut **self)[index]
2068
4.00M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
7.71k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
7.71k
        &mut (&mut **self)[index]
2068
7.71k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
6.93k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
6.93k
        &mut (&mut **self)[index]
2068
6.93k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Line
Count
Source
2066
32.8k
    fn index_mut(&mut self, index: I) -> &mut I::Output {
2067
32.8k
        &mut (&mut **self)[index]
2068
32.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut
2069
}
2070
2071
#[allow(deprecated)]
2072
impl<A: Array> ExtendFromSlice<A::Item> for SmallVec<A>
2073
where
2074
    A::Item: Copy,
2075
{
2076
    fn extend_from_slice(&mut self, other: &[A::Item]) {
2077
        SmallVec::extend_from_slice(self, other)
2078
    }
2079
}
2080
2081
impl<A: Array> FromIterator<A::Item> for SmallVec<A> {
2082
    #[inline]
2083
3.41M
    fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> {
2084
3.41M
        let mut v = SmallVec::new();
2085
3.41M
        v.extend(iterable);
2086
3.41M
        v
2087
3.41M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::FromIterator<gix_config::parse::Event>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_config::parse::Event>>>
Line
Count
Source
2083
6.14k
    fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> {
2084
6.14k
        let mut v = SmallVec::new();
2085
6.14k
        v.extend(iterable);
2086
6.14k
        v
2087
6.14k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::FromIterator<gix_config::parse::Event>>::from_iter::<alloc::vec::into_iter::IntoIter<gix_config::parse::Event>>
Line
Count
Source
2083
19.8k
    fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> {
2084
19.8k
        let mut v = SmallVec::new();
2085
19.8k
        v.extend(iterable);
2086
19.8k
        v
2087
19.8k
    }
<smallvec::SmallVec<[u8; 2]> as core::iter::traits::collect::FromIterator<u8>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>>
Line
Count
Source
2083
50.8k
    fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> {
2084
50.8k
        let mut v = SmallVec::new();
2085
50.8k
        v.extend(iterable);
2086
50.8k
        v
2087
50.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::FromIterator<gix_hash::object_id::ObjectId>>::from_iter::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::FromIterator<&bstr::bstr::BStr>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::FromIterator<gix_hash::object_id::ObjectId>>::from_iter::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::FromIterator<&bstr::bstr::BStr>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::FromIterator<gix_hash::object_id::ObjectId>>::from_iter::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::FromIterator<&bstr::bstr::BStr>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::FromIterator<gix_hash::object_id::ObjectId>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_hash::object_id::ObjectId>>>
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::iter::traits::collect::FromIterator<u8>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]> as core::iter::traits::collect::FromIterator<gix_attributes::search::Match>>::from_iter::<core::iter::adapters::map::Map<core::slice::iter::Iter<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>, <gix_attributes::search::Outcome>::iter_selected::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::FromIterator<gix_hash::object_id::ObjectId>>::from_iter::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::FromIterator<&bstr::bstr::BStr>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::FromIterator<gix_attributes::search::TrackedAssignment>>::from_iter::<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<gix_attributes::parse::Iter, <gix_attributes::search::Attributes as gix_glob::search::Pattern>::bytes_to_patterns::into_owned_assignments<gix_attributes::parse::Iter>::{closure#0}>, core::result::Result<core::convert::Infallible, gix_attributes::name::Error>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::FromIterator<gix_attributes::search::TrackedAssignment>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>>
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::FromIterator<gix_attributes::search::TrackedAssignment>>::from_iter::<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<gix_attributes::parse::Iter, <gix_attributes::search::Attributes as gix_glob::search::Pattern>::bytes_to_patterns::into_owned_assignments<gix_attributes::parse::Iter>::{closure#0}>, core::result::Result<core::convert::Infallible, gix_attributes::name::Error>>>
Line
Count
Source
2083
2.60M
    fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> {
2084
2.60M
        let mut v = SmallVec::new();
2085
2.60M
        v.extend(iterable);
2086
2.60M
        v
2087
2.60M
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::FromIterator<gix_attributes::search::TrackedAssignment>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>>
Line
Count
Source
2083
738k
    fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> {
2084
738k
        let mut v = SmallVec::new();
2085
738k
        v.extend(iterable);
2086
738k
        v
2087
738k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::iter::traits::collect::FromIterator<core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>>>::from_iter::<gix_revwalk::graph::commit::Parents>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::FromIterator<gix_hash::object_id::ObjectId>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_hash::object_id::ObjectId>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::FromIterator<gix_attributes::search::TrackedAssignment>>::from_iter::<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<gix_attributes::parse::Iter, <gix_attributes::search::Attributes as gix_glob::search::Pattern>::bytes_to_patterns::into_owned_assignments<gix_attributes::parse::Iter>::{closure#0}>, core::result::Result<core::convert::Infallible, gix_attributes::name::Error>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::FromIterator<gix_attributes::search::TrackedAssignment>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>>
2088
}
2089
2090
impl<A: Array> Extend<A::Item> for SmallVec<A> {
2091
3.46M
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
3.46M
        let mut iter = iterable.into_iter();
2093
3.46M
        let (lower_size_bound, _) = iter.size_hint();
2094
3.46M
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
3.46M
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
3.46M
            let ptr = ptr.as_ptr();
2099
3.46M
            let mut len = SetLenOnDrop::new(len_ptr);
2100
50.3M
            while len.get() < cap {
2101
50.3M
                if let Some(out) = iter.next() {
2102
46.9M
                    ptr::write(ptr.add(len.get()), out);
2103
46.9M
                    len.increment_len(1);
2104
46.9M
                } else {
2105
3.38M
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
8.56M
        for elem in iter {
2111
8.56M
            self.push(elem);
2112
8.56M
        }
2113
3.46M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::Extend<gix_config::parse::Event>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_config::parse::Event>>>
Line
Count
Source
2091
6.14k
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
6.14k
        let mut iter = iterable.into_iter();
2093
6.14k
        let (lower_size_bound, _) = iter.size_hint();
2094
6.14k
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
6.14k
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
6.14k
            let ptr = ptr.as_ptr();
2099
6.14k
            let mut len = SetLenOnDrop::new(len_ptr);
2100
7.51M
            while len.get() < cap {
2101
7.51M
                if let Some(out) = iter.next() {
2102
7.51M
                    ptr::write(ptr.add(len.get()), out);
2103
7.51M
                    len.increment_len(1);
2104
7.51M
                } else {
2105
6.09k
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
51
        for elem in iter {
2111
0
            self.push(elem);
2112
0
        }
2113
6.14k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::Extend<gix_config::parse::Event>>::extend::<smallvec::SmallVec<[gix_config::parse::Event; 8]>>
Line
Count
Source
2091
1.17k
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
1.17k
        let mut iter = iterable.into_iter();
2093
1.17k
        let (lower_size_bound, _) = iter.size_hint();
2094
1.17k
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
1.17k
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
1.17k
            let ptr = ptr.as_ptr();
2099
1.17k
            let mut len = SetLenOnDrop::new(len_ptr);
2100
7.51M
            while len.get() < cap {
2101
7.51M
                if let Some(out) = iter.next() {
2102
7.51M
                    ptr::write(ptr.add(len.get()), out);
2103
7.51M
                    len.increment_len(1);
2104
7.51M
                } else {
2105
1.13k
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
40
        for elem in iter {
2111
0
            self.push(elem);
2112
0
        }
2113
1.17k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::Extend<gix_config::parse::Event>>::extend::<alloc::vec::into_iter::IntoIter<gix_config::parse::Event>>
Line
Count
Source
2091
19.8k
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
19.8k
        let mut iter = iterable.into_iter();
2093
19.8k
        let (lower_size_bound, _) = iter.size_hint();
2094
19.8k
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
19.8k
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
19.8k
            let ptr = ptr.as_ptr();
2099
19.8k
            let mut len = SetLenOnDrop::new(len_ptr);
2100
26.6M
            while len.get() < cap {
2101
26.6M
                if let Some(out) = iter.next() {
2102
26.6M
                    ptr::write(ptr.add(len.get()), out);
2103
26.6M
                    len.increment_len(1);
2104
26.6M
                } else {
2105
19.7k
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
112
        for elem in iter {
2111
0
            self.push(elem);
2112
0
        }
2113
19.8k
    }
<smallvec::SmallVec<[u8; 2]> as core::iter::traits::collect::Extend<u8>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>>
Line
Count
Source
2091
50.8k
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
50.8k
        let mut iter = iterable.into_iter();
2093
50.8k
        let (lower_size_bound, _) = iter.size_hint();
2094
50.8k
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
50.8k
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
50.8k
            let ptr = ptr.as_ptr();
2099
50.8k
            let mut len = SetLenOnDrop::new(len_ptr);
2100
110k
            while len.get() < cap {
2101
101k
                if let Some(out) = iter.next() {
2102
59.3k
                    ptr::write(ptr.add(len.get()), out);
2103
59.3k
                    len.increment_len(1);
2104
59.3k
                } else {
2105
42.3k
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
8.45k
        for elem in iter {
2111
0
            self.push(elem);
2112
0
        }
2113
50.8k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::Extend<gix_hash::object_id::ObjectId>>::extend::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::Extend<&bstr::bstr::BStr>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::Extend<gix_hash::object_id::ObjectId>>::extend::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::Extend<&bstr::bstr::BStr>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::Extend<gix_hash::object_id::ObjectId>>::extend::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::Extend<&bstr::bstr::BStr>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::Extend<gix_hash::object_id::ObjectId>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_hash::object_id::ObjectId>>>
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::iter::traits::collect::Extend<u8>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]> as core::iter::traits::collect::Extend<gix_attributes::search::Match>>::extend::<core::iter::adapters::map::Map<core::slice::iter::Iter<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>, <gix_attributes::search::Outcome>::iter_selected::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::Extend<gix_hash::object_id::ObjectId>>::extend::<core::iter::adapters::map::Map<core::slice::iter::Iter<&bstr::bstr::BStr>, <gix_object::Commit as core::convert::TryFrom<gix_object::CommitRef>>::try_from::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::iter::traits::collect::Extend<&bstr::bstr::BStr>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<&bstr::bstr::BStr>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::Extend<gix_attributes::search::TrackedAssignment>>::extend::<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<gix_attributes::parse::Iter, <gix_attributes::search::Attributes as gix_glob::search::Pattern>::bytes_to_patterns::into_owned_assignments<gix_attributes::parse::Iter>::{closure#0}>, core::result::Result<core::convert::Infallible, gix_attributes::name::Error>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::Extend<gix_attributes::search::TrackedAssignment>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>>
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::iter::traits::collect::Extend<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<&mut dyn core::iter::traits::iterator::Iterator<Item = kstring::string_ref::KStringRef>, <gix_attributes::search::Outcome>::initialize_with_selection_inner::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::iter::traits::collect::Extend<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<core::iter::adapters::filter::Filter<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#0}>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#1}>>
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::iter::traits::collect::Extend<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<core::iter::adapters::filter::Filter<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#3}>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#4}>>
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::Extend<gix_attributes::search::TrackedAssignment>>::extend::<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<gix_attributes::parse::Iter, <gix_attributes::search::Attributes as gix_glob::search::Pattern>::bytes_to_patterns::into_owned_assignments<gix_attributes::parse::Iter>::{closure#0}>, core::result::Result<core::convert::Infallible, gix_attributes::name::Error>>>
Line
Count
Source
2091
2.60M
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
2.60M
        let mut iter = iterable.into_iter();
2093
2.60M
        let (lower_size_bound, _) = iter.size_hint();
2094
2.60M
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
2.60M
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
2.60M
            let ptr = ptr.as_ptr();
2099
2.60M
            let mut len = SetLenOnDrop::new(len_ptr);
2100
3.54M
            while len.get() < cap {
2101
3.47M
                if let Some(out) = iter.next() {
2102
944k
                    ptr::write(ptr.add(len.get()), out);
2103
944k
                    len.increment_len(1);
2104
944k
                } else {
2105
2.53M
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
5.22M
        for elem in iter {
2111
5.22M
            self.push(elem);
2112
5.22M
        }
2113
2.60M
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::Extend<gix_attributes::search::TrackedAssignment>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>>
Line
Count
Source
2091
755k
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
755k
        let mut iter = iterable.into_iter();
2093
755k
        let (lower_size_bound, _) = iter.size_hint();
2094
755k
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
755k
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
755k
            let ptr = ptr.as_ptr();
2099
755k
            let mut len = SetLenOnDrop::new(len_ptr);
2100
4.94M
            while len.get() < cap {
2101
4.94M
                if let Some(out) = iter.next() {
2102
4.18M
                    ptr::write(ptr.add(len.get()), out);
2103
4.18M
                    len.increment_len(1);
2104
4.18M
                } else {
2105
752k
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
2.95k
        for elem in iter {
2111
0
            self.push(elem);
2112
0
        }
2113
755k
    }
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::iter::traits::collect::Extend<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<&mut dyn core::iter::traits::iterator::Iterator<Item = kstring::string_ref::KStringRef>, <gix_attributes::search::Outcome>::initialize_with_selection_inner::{closure#0}>>
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::iter::traits::collect::Extend<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<core::iter::adapters::filter::Filter<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#0}>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#1}>>
Line
Count
Source
2091
26.5k
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
26.5k
        let mut iter = iterable.into_iter();
2093
26.5k
        let (lower_size_bound, _) = iter.size_hint();
2094
26.5k
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
26.5k
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
26.5k
            let ptr = ptr.as_ptr();
2099
26.5k
            let mut len = SetLenOnDrop::new(len_ptr);
2100
111k
            while len.get() < cap {
2101
110k
                if let Some(out) = iter.next() {
2102
84.8k
                    ptr::write(ptr.add(len.get()), out);
2103
84.8k
                    len.increment_len(1);
2104
84.8k
                } else {
2105
25.7k
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
1.82M
        for elem in iter {
2111
1.82M
            self.push(elem);
2112
1.82M
        }
2113
26.5k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::iter::traits::collect::Extend<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<core::iter::adapters::filter::Filter<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#3}>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#4}>>
Line
Count
Source
2091
943
    fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) {
2092
943
        let mut iter = iterable.into_iter();
2093
943
        let (lower_size_bound, _) = iter.size_hint();
2094
943
        self.reserve(lower_size_bound);
2095
2096
        unsafe {
2097
943
            let (ptr, len_ptr, cap) = self.triple_mut();
2098
943
            let ptr = ptr.as_ptr();
2099
943
            let mut len = SetLenOnDrop::new(len_ptr);
2100
12.2k
            while len.get() < cap {
2101
11.8k
                if let Some(out) = iter.next() {
2102
11.2k
                    ptr::write(ptr.add(len.get()), out);
2103
11.2k
                    len.increment_len(1);
2104
11.2k
                } else {
2105
598
                    return;
2106
                }
2107
            }
2108
        }
2109
2110
1.52M
        for elem in iter {
2111
1.52M
            self.push(elem);
2112
1.52M
        }
2113
943
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::iter::traits::collect::Extend<core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>>>::extend::<gix_revwalk::graph::commit::Parents>
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::Extend<gix_hash::object_id::ObjectId>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_hash::object_id::ObjectId>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::Extend<gix_attributes::search::TrackedAssignment>>::extend::<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<gix_attributes::parse::Iter, <gix_attributes::search::Attributes as gix_glob::search::Pattern>::bytes_to_patterns::into_owned_assignments<gix_attributes::parse::Iter>::{closure#0}>, core::result::Result<core::convert::Infallible, gix_attributes::name::Error>>>
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::iter::traits::collect::Extend<gix_attributes::search::TrackedAssignment>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>>
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::iter::traits::collect::Extend<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<&mut dyn core::iter::traits::iterator::Iterator<Item = kstring::string_ref::KStringRef>, <gix_attributes::search::Outcome>::initialize_with_selection_inner::{closure#0}>>
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::iter::traits::collect::Extend<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<core::iter::adapters::filter::Filter<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#0}>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#1}>>
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::iter::traits::collect::Extend<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::extend::<core::iter::adapters::map::Map<core::iter::adapters::filter::Filter<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#3}>, <gix_attributes::search::Outcome>::fill_attributes<core::slice::iter::Iter<gix_attributes::search::TrackedAssignment>>::{closure#4}>>
2114
}
2115
2116
impl<A: Array> fmt::Debug for SmallVec<A>
2117
where
2118
    A::Item: fmt::Debug,
2119
{
2120
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2121
        f.debug_list().entries(self.iter()).finish()
2122
    }
2123
}
2124
2125
impl<A: Array> Default for SmallVec<A> {
2126
    #[inline]
2127
802k
    fn default() -> SmallVec<A> {
2128
802k
        SmallVec::new()
2129
802k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::default::Default>::default
Line
Count
Source
2127
12.1k
    fn default() -> SmallVec<A> {
2128
12.1k
        SmallVec::new()
2129
12.1k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::default::Default>::default
Line
Count
Source
2127
25.6k
    fn default() -> SmallVec<A> {
2128
25.6k
        SmallVec::new()
2129
25.6k
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::default::Default>::default
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::default::Default>::default
Line
Count
Source
2127
7.71k
    fn default() -> SmallVec<A> {
2128
7.71k
        SmallVec::new()
2129
7.71k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::default::Default>::default
Line
Count
Source
2127
7.71k
    fn default() -> SmallVec<A> {
2128
7.71k
        SmallVec::new()
2129
7.71k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::default::Default>::default
Line
Count
Source
2127
749k
    fn default() -> SmallVec<A> {
2128
749k
        SmallVec::new()
2129
749k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::default::Default>::default
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::default::Default>::default
2130
}
2131
2132
#[cfg(feature = "may_dangle")]
2133
unsafe impl<#[may_dangle] A: Array> Drop for SmallVec<A> {
2134
    fn drop(&mut self) {
2135
        unsafe {
2136
            if self.spilled() {
2137
                let (ptr, &mut len) = self.data.heap_mut();
2138
                Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity);
2139
            } else {
2140
                ptr::drop_in_place(&mut self[..]);
2141
            }
2142
        }
2143
    }
2144
}
2145
2146
#[cfg(not(feature = "may_dangle"))]
2147
impl<A: Array> Drop for SmallVec<A> {
2148
4.22M
    fn drop(&mut self) {
2149
        unsafe {
2150
4.22M
            if self.spilled() {
2151
54.0k
                let (ptr, &mut len) = self.data.heap_mut();
2152
54.0k
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
4.16M
            } else {
2154
4.16M
                ptr::drop_in_place(&mut self[..]);
2155
4.16M
            }
2156
        }
2157
4.22M
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
24.8k
    fn drop(&mut self) {
2149
        unsafe {
2150
24.8k
            if self.spilled() {
2151
630
                let (ptr, &mut len) = self.data.heap_mut();
2152
630
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
24.2k
            } else {
2154
24.2k
                ptr::drop_in_place(&mut self[..]);
2155
24.2k
            }
2156
        }
2157
24.8k
    }
<smallvec::SmallVec<[u8; 2]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
44.7k
    fn drop(&mut self) {
2149
        unsafe {
2150
44.7k
            if self.spilled() {
2151
0
                let (ptr, &mut len) = self.data.heap_mut();
2152
0
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
44.7k
            } else {
2154
44.7k
                ptr::drop_in_place(&mut self[..]);
2155
44.7k
            }
2156
        }
2157
44.7k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
32.1k
    fn drop(&mut self) {
2149
        unsafe {
2150
32.1k
            if self.spilled() {
2151
293
                let (ptr, &mut len) = self.data.heap_mut();
2152
293
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
31.9k
            } else {
2154
31.9k
                ptr::drop_in_place(&mut self[..]);
2155
31.9k
            }
2156
        }
2157
32.1k
    }
<smallvec::SmallVec<[u8; 2]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
6.14k
    fn drop(&mut self) {
2149
        unsafe {
2150
6.14k
            if self.spilled() {
2151
0
                let (ptr, &mut len) = self.data.heap_mut();
2152
0
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
6.14k
            } else {
2154
6.14k
                ptr::drop_in_place(&mut self[..]);
2155
6.14k
            }
2156
        }
2157
6.14k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]> as core::ops::drop::Drop>::drop
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
6.65k
    fn drop(&mut self) {
2149
        unsafe {
2150
6.65k
            if self.spilled() {
2151
113
                let (ptr, &mut len) = self.data.heap_mut();
2152
113
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
6.53k
            } else {
2154
6.53k
                ptr::drop_in_place(&mut self[..]);
2155
6.53k
            }
2156
        }
2157
6.65k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
<smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
201
    fn drop(&mut self) {
2149
        unsafe {
2150
201
            if self.spilled() {
2151
14
                let (ptr, &mut len) = self.data.heap_mut();
2152
14
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
187
            } else {
2154
187
                ptr::drop_in_place(&mut self[..]);
2155
187
            }
2156
        }
2157
201
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
<smallvec::SmallVec<[u8; 256]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
430
    fn drop(&mut self) {
2149
        unsafe {
2150
430
            if self.spilled() {
2151
201
                let (ptr, &mut len) = self.data.heap_mut();
2152
201
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
229
            } else {
2154
229
                ptr::drop_in_place(&mut self[..]);
2155
229
            }
2156
        }
2157
430
    }
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::Match; 6]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 25]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
4.04M
    fn drop(&mut self) {
2149
        unsafe {
2150
4.04M
            if self.spilled() {
2151
44.0k
                let (ptr, &mut len) = self.data.heap_mut();
2152
44.0k
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
4.00M
            } else {
2154
4.00M
                ptr::drop_in_place(&mut self[..]);
2155
4.00M
            }
2156
        }
2157
4.04M
    }
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
7.71k
    fn drop(&mut self) {
2149
        unsafe {
2150
7.71k
            if self.spilled() {
2151
0
                let (ptr, &mut len) = self.data.heap_mut();
2152
0
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
7.71k
            } else {
2154
7.71k
                ptr::drop_in_place(&mut self[..]);
2155
7.71k
            }
2156
        }
2157
7.71k
    }
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
7.71k
    fn drop(&mut self) {
2149
        unsafe {
2150
7.71k
            if self.spilled() {
2151
785
                let (ptr, &mut len) = self.data.heap_mut();
2152
785
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
6.93k
            } else {
2154
6.93k
                ptr::drop_in_place(&mut self[..]);
2155
6.93k
            }
2156
        }
2157
7.71k
    }
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
Line
Count
Source
2148
40.9k
    fn drop(&mut self) {
2149
        unsafe {
2150
40.9k
            if self.spilled() {
2151
8.03k
                let (ptr, &mut len) = self.data.heap_mut();
2152
8.03k
                drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity));
2153
32.8k
            } else {
2154
32.8k
                ptr::drop_in_place(&mut self[..]);
2155
32.8k
            }
2156
        }
2157
40.9k
    }
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop
2158
}
2159
2160
impl<A: Array> Clone for SmallVec<A>
2161
where
2162
    A::Item: Clone,
2163
{
2164
    #[inline]
2165
744k
    fn clone(&self) -> SmallVec<A> {
2166
744k
        SmallVec::from(self.as_slice())
2167
744k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::clone::Clone>::clone
Line
Count
Source
2165
6.14k
    fn clone(&self) -> SmallVec<A> {
2166
6.14k
        SmallVec::from(self.as_slice())
2167
6.14k
    }
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::clone::Clone>::clone
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::clone::Clone>::clone
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::clone::Clone>::clone
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::clone::Clone>::clone
Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::clone::Clone>::clone
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::clone::Clone>::clone
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::clone::Clone>::clone
Line
Count
Source
2165
738k
    fn clone(&self) -> SmallVec<A> {
2166
738k
        SmallVec::from(self.as_slice())
2167
738k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::clone::Clone>::clone
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::clone::Clone>::clone
2168
2169
16.5k
    fn clone_from(&mut self, source: &Self) {
2170
        // Inspired from `impl Clone for Vec`.
2171
2172
        // drop anything that will not be overwritten
2173
16.5k
        self.truncate(source.len());
2174
2175
        // self.len <= other.len due to the truncate above, so the
2176
        // slices here are always in-bounds.
2177
16.5k
        let (init, tail) = source.split_at(self.len());
2178
2179
        // reuse the contained values' allocations/resources.
2180
16.5k
        self.clone_from_slice(init);
2181
16.5k
        self.extend(tail.iter().cloned());
2182
16.5k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::clone::Clone>::clone_from
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::clone::Clone>::clone_from
Line
Count
Source
2169
16.5k
    fn clone_from(&mut self, source: &Self) {
2170
        // Inspired from `impl Clone for Vec`.
2171
2172
        // drop anything that will not be overwritten
2173
16.5k
        self.truncate(source.len());
2174
2175
        // self.len <= other.len due to the truncate above, so the
2176
        // slices here are always in-bounds.
2177
16.5k
        let (init, tail) = source.split_at(self.len());
2178
2179
        // reuse the contained values' allocations/resources.
2180
16.5k
        self.clone_from_slice(init);
2181
16.5k
        self.extend(tail.iter().cloned());
2182
16.5k
    }
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::clone::Clone>::clone_from
2183
}
2184
2185
impl<A: Array, B: Array> PartialEq<SmallVec<B>> for SmallVec<A>
2186
where
2187
    A::Item: PartialEq<B::Item>,
2188
{
2189
    #[inline]
2190
0
    fn eq(&self, other: &SmallVec<B>) -> bool {
2191
0
        self[..] == other[..]
2192
0
    }
2193
}
2194
2195
impl<A: Array> Eq for SmallVec<A> where A::Item: Eq {}
2196
2197
impl<A: Array> PartialOrd for SmallVec<A>
2198
where
2199
    A::Item: PartialOrd,
2200
{
2201
    #[inline]
2202
    fn partial_cmp(&self, other: &SmallVec<A>) -> Option<cmp::Ordering> {
2203
        PartialOrd::partial_cmp(&**self, &**other)
2204
    }
2205
}
2206
2207
impl<A: Array> Ord for SmallVec<A>
2208
where
2209
    A::Item: Ord,
2210
{
2211
    #[inline]
2212
0
    fn cmp(&self, other: &SmallVec<A>) -> cmp::Ordering {
2213
0
        Ord::cmp(&**self, &**other)
2214
0
    }
2215
}
2216
2217
impl<A: Array> Hash for SmallVec<A>
2218
where
2219
    A::Item: Hash,
2220
{
2221
    fn hash<H: Hasher>(&self, state: &mut H) {
2222
        (**self).hash(state)
2223
    }
2224
}
2225
2226
unsafe impl<A: Array> Send for SmallVec<A> where A::Item: Send {}
2227
2228
/// An iterator that consumes a `SmallVec` and yields its items by value.
2229
///
2230
/// Returned from [`SmallVec::into_iter`][1].
2231
///
2232
/// [1]: struct.SmallVec.html#method.into_iter
2233
pub struct IntoIter<A: Array> {
2234
    data: SmallVec<A>,
2235
    current: usize,
2236
    end: usize,
2237
}
2238
2239
impl<A: Array> fmt::Debug for IntoIter<A>
2240
where
2241
    A::Item: fmt::Debug,
2242
{
2243
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2244
        f.debug_tuple("IntoIter").field(&self.as_slice()).finish()
2245
    }
2246
}
2247
2248
impl<A: Array + Clone> Clone for IntoIter<A>
2249
where
2250
    A::Item: Clone,
2251
{
2252
    fn clone(&self) -> IntoIter<A> {
2253
        SmallVec::from(self.as_slice()).into_iter()
2254
    }
2255
}
2256
2257
impl<A: Array> Drop for IntoIter<A> {
2258
1.17k
    fn drop(&mut self) {
2259
1.17k
        for _ in self {}
2260
1.17k
    }
<smallvec::IntoIter<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop
Line
Count
Source
2258
1.17k
    fn drop(&mut self) {
2259
1.17k
        for _ in self {}
2260
1.17k
    }
Unexecuted instantiation: <smallvec::IntoIter<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::IntoIter<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::IntoIter<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::IntoIter<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::IntoIter<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <smallvec::IntoIter<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop
2261
}
2262
2263
impl<A: Array> Iterator for IntoIter<A> {
2264
    type Item = A::Item;
2265
2266
    #[inline]
2267
7.51M
    fn next(&mut self) -> Option<A::Item> {
2268
7.51M
        if self.current == self.end {
2269
2.35k
            None
2270
        } else {
2271
            unsafe {
2272
7.51M
                let current = self.current;
2273
7.51M
                self.current += 1;
2274
7.51M
                Some(ptr::read(self.data.as_ptr().add(current)))
2275
            }
2276
        }
2277
7.51M
    }
<smallvec::IntoIter<[gix_config::parse::Event; 8]> as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
2267
7.51M
    fn next(&mut self) -> Option<A::Item> {
2268
7.51M
        if self.current == self.end {
2269
2.35k
            None
2270
        } else {
2271
            unsafe {
2272
7.51M
                let current = self.current;
2273
7.51M
                self.current += 1;
2274
7.51M
                Some(ptr::read(self.data.as_ptr().add(current)))
2275
            }
2276
        }
2277
7.51M
    }
Unexecuted instantiation: <smallvec::IntoIter<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <smallvec::IntoIter<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <smallvec::IntoIter<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <smallvec::IntoIter<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <smallvec::IntoIter<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <smallvec::IntoIter<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::iterator::Iterator>::next
2278
2279
    #[inline]
2280
1.17k
    fn size_hint(&self) -> (usize, Option<usize>) {
2281
1.17k
        let size = self.end - self.current;
2282
1.17k
        (size, Some(size))
2283
1.17k
    }
2284
}
2285
2286
impl<A: Array> DoubleEndedIterator for IntoIter<A> {
2287
    #[inline]
2288
    fn next_back(&mut self) -> Option<A::Item> {
2289
        if self.current == self.end {
2290
            None
2291
        } else {
2292
            unsafe {
2293
                self.end -= 1;
2294
                Some(ptr::read(self.data.as_ptr().add(self.end)))
2295
            }
2296
        }
2297
    }
2298
}
2299
2300
impl<A: Array> ExactSizeIterator for IntoIter<A> {}
2301
impl<A: Array> FusedIterator for IntoIter<A> {}
2302
2303
impl<A: Array> IntoIter<A> {
2304
    /// Returns the remaining items of this iterator as a slice.
2305
    pub fn as_slice(&self) -> &[A::Item] {
2306
        let len = self.end - self.current;
2307
        unsafe { core::slice::from_raw_parts(self.data.as_ptr().add(self.current), len) }
2308
    }
2309
2310
    /// Returns the remaining items of this iterator as a mutable slice.
2311
    pub fn as_mut_slice(&mut self) -> &mut [A::Item] {
2312
        let len = self.end - self.current;
2313
        unsafe { core::slice::from_raw_parts_mut(self.data.as_mut_ptr().add(self.current), len) }
2314
    }
2315
}
2316
2317
impl<A: Array> IntoIterator for SmallVec<A> {
2318
    type IntoIter = IntoIter<A>;
2319
    type Item = A::Item;
2320
1.17k
    fn into_iter(mut self) -> Self::IntoIter {
2321
        unsafe {
2322
            // Set SmallVec len to zero as `IntoIter` drop handles dropping of the elements
2323
1.17k
            let len = self.len();
2324
1.17k
            self.set_len(0);
2325
1.17k
            IntoIter {
2326
1.17k
                data: self,
2327
1.17k
                current: 0,
2328
1.17k
                end: len,
2329
1.17k
            }
2330
        }
2331
1.17k
    }
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
2320
1.17k
    fn into_iter(mut self) -> Self::IntoIter {
2321
        unsafe {
2322
            // Set SmallVec len to zero as `IntoIter` drop handles dropping of the elements
2323
1.17k
            let len = self.len();
2324
1.17k
            self.set_len(0);
2325
1.17k
            IntoIter {
2326
1.17k
                data: self,
2327
1.17k
                current: 0,
2328
1.17k
                end: len,
2329
1.17k
            }
2330
        }
2331
1.17k
    }
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <smallvec::SmallVec<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <smallvec::SmallVec<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <smallvec::SmallVec<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
2332
}
2333
2334
impl<'a, A: Array> IntoIterator for &'a SmallVec<A> {
2335
    type IntoIter = slice::Iter<'a, A::Item>;
2336
    type Item = &'a A::Item;
2337
659
    fn into_iter(self) -> Self::IntoIter {
2338
659
        self.iter()
2339
659
    }
<&smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
2337
659
    fn into_iter(self) -> Self::IntoIter {
2338
659
        self.iter()
2339
659
    }
Unexecuted instantiation: <&smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <&smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <&smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <&smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <&smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <&smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::iter::traits::collect::IntoIterator>::into_iter
2340
}
2341
2342
impl<'a, A: Array> IntoIterator for &'a mut SmallVec<A> {
2343
    type IntoIter = slice::IterMut<'a, A::Item>;
2344
    type Item = &'a mut A::Item;
2345
    fn into_iter(self) -> Self::IntoIter {
2346
        self.iter_mut()
2347
    }
2348
}
2349
2350
/// Types that can be used as the backing store for a [`SmallVec`].
2351
pub unsafe trait Array {
2352
    /// The type of the array's elements.
2353
    type Item;
2354
    /// Returns the number of items the array can hold.
2355
    fn size() -> usize;
2356
}
2357
2358
/// Set the length of the vec when the `SetLenOnDrop` value goes out of scope.
2359
///
2360
/// Copied from <https://github.com/rust-lang/rust/pull/36355>
2361
struct SetLenOnDrop<'a> {
2362
    len: &'a mut usize,
2363
    local_len: usize,
2364
}
2365
2366
impl<'a> SetLenOnDrop<'a> {
2367
    #[inline]
2368
3.46M
    fn new(len: &'a mut usize) -> Self {
2369
3.46M
        SetLenOnDrop {
2370
3.46M
            local_len: *len,
2371
3.46M
            len,
2372
3.46M
        }
2373
3.46M
    }
<smallvec::SetLenOnDrop>::new
Line
Count
Source
2368
78.0k
    fn new(len: &'a mut usize) -> Self {
2369
78.0k
        SetLenOnDrop {
2370
78.0k
            local_len: *len,
2371
78.0k
            len,
2372
78.0k
        }
2373
78.0k
    }
<smallvec::SetLenOnDrop>::new
Line
Count
Source
2368
3.38M
    fn new(len: &'a mut usize) -> Self {
2369
3.38M
        SetLenOnDrop {
2370
3.38M
            local_len: *len,
2371
3.38M
            len,
2372
3.38M
        }
2373
3.38M
    }
2374
2375
    #[inline]
2376
97.3M
    fn get(&self) -> usize {
2377
97.3M
        self.local_len
2378
97.3M
    }
<smallvec::SetLenOnDrop>::get
Line
Count
Source
2376
83.4M
    fn get(&self) -> usize {
2377
83.4M
        self.local_len
2378
83.4M
    }
<smallvec::SetLenOnDrop>::get
Line
Count
Source
2376
13.8M
    fn get(&self) -> usize {
2377
13.8M
        self.local_len
2378
13.8M
    }
2379
2380
    #[inline]
2381
46.9M
    fn increment_len(&mut self, increment: usize) {
2382
46.9M
        self.local_len += increment;
2383
46.9M
    }
<smallvec::SetLenOnDrop>::increment_len
Line
Count
Source
2381
41.6M
    fn increment_len(&mut self, increment: usize) {
2382
41.6M
        self.local_len += increment;
2383
41.6M
    }
<smallvec::SetLenOnDrop>::increment_len
Line
Count
Source
2381
5.22M
    fn increment_len(&mut self, increment: usize) {
2382
5.22M
        self.local_len += increment;
2383
5.22M
    }
2384
}
2385
2386
impl<'a> Drop for SetLenOnDrop<'a> {
2387
    #[inline]
2388
3.46M
    fn drop(&mut self) {
2389
3.46M
        *self.len = self.local_len;
2390
3.46M
    }
<smallvec::SetLenOnDrop as core::ops::drop::Drop>::drop
Line
Count
Source
2388
78.0k
    fn drop(&mut self) {
2389
78.0k
        *self.len = self.local_len;
2390
78.0k
    }
<smallvec::SetLenOnDrop as core::ops::drop::Drop>::drop
Line
Count
Source
2388
3.38M
    fn drop(&mut self) {
2389
3.38M
        *self.len = self.local_len;
2390
3.38M
    }
2391
}
2392
2393
#[cfg(feature = "const_new")]
2394
impl<T, const N: usize> SmallVec<[T; N]> {
2395
    /// Construct an empty vector.
2396
    ///
2397
    /// This is a `const` version of [`SmallVec::new`] that is enabled by the feature `const_new`, with the limitation that it only works for arrays.
2398
    #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))]
2399
    #[inline]
2400
    pub const fn new_const() -> Self {
2401
        SmallVec {
2402
            capacity: 0,
2403
            data: SmallVecData::from_const(MaybeUninit::uninit()),
2404
        }
2405
    }
2406
2407
    /// The array passed as an argument is moved to be an inline version of `SmallVec`.
2408
    ///
2409
    /// This is a `const` version of [`SmallVec::from_buf`] that is enabled by the feature `const_new`, with the limitation that it only works for arrays.
2410
    #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))]
2411
    #[inline]
2412
    pub const fn from_const(items: [T; N]) -> Self {
2413
        SmallVec {
2414
            capacity: N,
2415
            data: SmallVecData::from_const(MaybeUninit::new(items)),
2416
        }
2417
    }
2418
2419
    /// Constructs a new `SmallVec` on the stack from an array without
2420
    /// copying elements. Also sets the length. The user is responsible
2421
    /// for ensuring that `len <= N`.
2422
    /// 
2423
    /// This is a `const` version of [`SmallVec::from_buf_and_len_unchecked`] that is enabled by the feature `const_new`, with the limitation that it only works for arrays.
2424
    #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))]
2425
    #[inline]
2426
    pub const unsafe fn from_const_with_len_unchecked(items: [T; N], len: usize) -> Self {
2427
        SmallVec {
2428
            capacity: len,
2429
            data: SmallVecData::from_const(MaybeUninit::new(items)),
2430
        }
2431
    }
2432
}
2433
2434
#[cfg(feature = "const_generics")]
2435
#[cfg_attr(docsrs, doc(cfg(feature = "const_generics")))]
2436
unsafe impl<T, const N: usize> Array for [T; N] {
2437
    type Item = T;
2438
    #[inline]
2439
    fn size() -> usize {
2440
        N
2441
    }
2442
}
2443
2444
#[cfg(not(feature = "const_generics"))]
2445
macro_rules! impl_array(
2446
    ($($size:expr),+) => {
2447
        $(
2448
            unsafe impl<T> Array for [T; $size] {
2449
                type Item = T;
2450
                #[inline]
2451
65.1M
                fn size() -> usize { $size }
<[gix_config::parse::Event; 8] as smallvec::Array>::size
Line
Count
Source
2451
129k
                fn size() -> usize { $size }
<[u8; 2] as smallvec::Array>::size
Line
Count
Source
2451
134k
                fn size() -> usize { $size }
<[gix_config::parse::Event; 8] as smallvec::Array>::size
Line
Count
Source
2451
7.91M
                fn size() -> usize { $size }
<[u8; 2] as smallvec::Array>::size
Line
Count
Source
2451
404k
                fn size() -> usize { $size }
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 28] as smallvec::Array>::size
Unexecuted instantiation: <[gix_hash::object_id::ObjectId; 1] as smallvec::Array>::size
Unexecuted instantiation: <[&bstr::bstr::BStr; 1] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[parking_lot_core::thread_parker::imp::UnparkHandle; 8] as smallvec::Array>::size
Unexecuted instantiation: <[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8] as smallvec::Array>::size
<[gix_config::parse::Event; 8] as smallvec::Array>::size
Line
Count
Source
2451
19.7k
                fn size() -> usize { $size }
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 28] as smallvec::Array>::size
Unexecuted instantiation: <[gix_hash::object_id::ObjectId; 1] as smallvec::Array>::size
<[&bstr::bstr::BStr; 1] as smallvec::Array>::size
Line
Count
Source
2451
201
                fn size() -> usize { $size }
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
<[&bstr::bstr::BStr; 1] as smallvec::Array>::size
Line
Count
Source
2451
575
                fn size() -> usize { $size }
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 28] as smallvec::Array>::size
Unexecuted instantiation: <[gix_hash::object_id::ObjectId; 1] as smallvec::Array>::size
Unexecuted instantiation: <[&bstr::bstr::BStr; 1] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
<[u8; 256] as smallvec::Array>::size
Line
Count
Source
2451
8.25k
                fn size() -> usize { $size }
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Unexecuted instantiation: <[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Unexecuted instantiation: <[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
Unexecuted instantiation: <[gix_hash::object_id::ObjectId; 1] as smallvec::Array>::size
Unexecuted instantiation: <[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Unexecuted instantiation: <[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Unexecuted instantiation: <[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 23] as smallvec::Array>::size
Unexecuted instantiation: <[gix_hash::object_id::ObjectId; 1] as smallvec::Array>::size
Unexecuted instantiation: <[(gix_hash::object_id::ObjectId, i64); 2] as smallvec::Array>::size
Unexecuted instantiation: <[parking_lot_core::thread_parker::imp::UnparkHandle; 8] as smallvec::Array>::size
Unexecuted instantiation: <[gix_attributes::search::Match; 6] as smallvec::Array>::size
Unexecuted instantiation: <[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Unexecuted instantiation: <[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Unexecuted instantiation: <[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 25] as smallvec::Array>::size
Unexecuted instantiation: <[u8; 28] as smallvec::Array>::size
Unexecuted instantiation: <[gix_hash::object_id::ObjectId; 1] as smallvec::Array>::size
Unexecuted instantiation: <[&bstr::bstr::BStr; 1] as smallvec::Array>::size
Unexecuted instantiation: <[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Unexecuted instantiation: <[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Unexecuted instantiation: <[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Line
Count
Source
2451
29.2k
                fn size() -> usize { $size }
<[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Line
Count
Source
2451
12.0M
                fn size() -> usize { $size }
<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
Line
Count
Source
2451
30.8k
                fn size() -> usize { $size }
<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Line
Count
Source
2451
6.82M
                fn size() -> usize { $size }
<[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Line
Count
Source
2451
37.3M
                fn size() -> usize { $size }
<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
Line
Count
Source
2451
239k
                fn size() -> usize { $size }
Unexecuted instantiation: <[gix_hash::object_id::ObjectId; 1] as smallvec::Array>::size
Unexecuted instantiation: <[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2] as smallvec::Array>::size
Unexecuted instantiation: <[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Unexecuted instantiation: <[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Unexecuted instantiation: <[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
Unexecuted instantiation: <[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8] as smallvec::Array>::size
Unexecuted instantiation: <[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size
Unexecuted instantiation: <[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3] as smallvec::Array>::size
2452
            }
2453
        )+
2454
    }
2455
);
2456
2457
#[cfg(not(feature = "const_generics"))]
2458
impl_array!(
2459
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2460
    26, 27, 28, 29, 30, 31, 32, 36, 0x40, 0x60, 0x80, 0x100, 0x200, 0x400, 0x600, 0x800, 0x1000,
2461
    0x2000, 0x4000, 0x6000, 0x8000, 0x10000, 0x20000, 0x40000, 0x60000, 0x80000, 0x10_0000
2462
);
2463
2464
/// Convenience trait for constructing a `SmallVec`
2465
pub trait ToSmallVec<A: Array> {
2466
    /// Construct a new `SmallVec` from a slice.
2467
    fn to_smallvec(&self) -> SmallVec<A>;
2468
}
2469
2470
impl<A: Array> ToSmallVec<A> for [A::Item]
2471
where
2472
    A::Item: Copy,
2473
{
2474
    #[inline]
2475
    fn to_smallvec(&self) -> SmallVec<A> {
2476
        SmallVec::from_slice(self)
2477
    }
2478
}
2479
2480
// Immutable counterpart for `NonNull<T>`.
2481
#[repr(transparent)]
2482
struct ConstNonNull<T>(NonNull<T>);
2483
2484
impl<T> ConstNonNull<T> {
2485
    #[inline]
2486
4.56M
    fn new(ptr: *const T) -> Option<Self> {
2487
4.56M
        NonNull::new(ptr as *mut T).map(Self)
2488
4.56M
    }
<smallvec::ConstNonNull<gix_config::parse::Event>>::new
Line
Count
Source
2486
5.90k
    fn new(ptr: *const T) -> Option<Self> {
2487
5.90k
        NonNull::new(ptr as *mut T).map(Self)
2488
5.90k
    }
<smallvec::ConstNonNull<gix_config::parse::Event>>::new
Line
Count
Source
2486
84.8k
    fn new(ptr: *const T) -> Option<Self> {
2487
84.8k
        NonNull::new(ptr as *mut T).map(Self)
2488
84.8k
    }
<smallvec::ConstNonNull<u8>>::new
Line
Count
Source
2486
65.8k
    fn new(ptr: *const T) -> Option<Self> {
2487
65.8k
        NonNull::new(ptr as *mut T).map(Self)
2488
65.8k
    }
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<parking_lot_core::thread_parker::imp::UnparkHandle>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>)>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
<smallvec::ConstNonNull<u8>>::new
Line
Count
Source
2486
916
    fn new(ptr: *const T) -> Option<Self> {
2487
916
        NonNull::new(ptr as *mut T).map(Self)
2488
916
    }
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<(gix_hash::object_id::ObjectId, i64)>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<parking_lot_core::thread_parker::imp::UnparkHandle>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_attributes::search::Match>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_attributes::search::TrackedAssignment>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::new
<smallvec::ConstNonNull<gix_attributes::search::TrackedAssignment>>::new
Line
Count
Source
2486
4.29M
    fn new(ptr: *const T) -> Option<Self> {
2487
4.29M
        NonNull::new(ptr as *mut T).map(Self)
2488
4.29M
    }
<smallvec::ConstNonNull<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::new
Line
Count
Source
2486
114k
    fn new(ptr: *const T) -> Option<Self> {
2487
114k
        NonNull::new(ptr as *mut T).map(Self)
2488
114k
    }
<smallvec::ConstNonNull<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::new
Line
Count
Source
2486
2.35k
    fn new(ptr: *const T) -> Option<Self> {
2487
2.35k
        NonNull::new(ptr as *mut T).map(Self)
2488
2.35k
    }
Unexecuted instantiation: <smallvec::ConstNonNull<core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<gix_attributes::search::TrackedAssignment>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::new
Unexecuted instantiation: <smallvec::ConstNonNull<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::new
2489
    #[inline]
2490
10.9M
    fn as_ptr(self) -> *const T {
2491
10.9M
        self.0.as_ptr()
2492
10.9M
    }
<smallvec::ConstNonNull<gix_config::parse::Event>>::as_ptr
Line
Count
Source
2490
6.14k
    fn as_ptr(self) -> *const T {
2491
6.14k
        self.0.as_ptr()
2492
6.14k
    }
<smallvec::ConstNonNull<gix_config::parse::Event>>::as_ptr
Line
Count
Source
2490
7.58M
    fn as_ptr(self) -> *const T {
2491
7.58M
        self.0.as_ptr()
2492
7.58M
    }
<smallvec::ConstNonNull<u8>>::as_ptr
Line
Count
Source
2490
65.8k
    fn as_ptr(self) -> *const T {
2491
65.8k
        self.0.as_ptr()
2492
65.8k
    }
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<parking_lot_core::thread_parker::imp::UnparkHandle>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>)>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
<smallvec::ConstNonNull<u8>>::as_ptr
Line
Count
Source
2490
860
    fn as_ptr(self) -> *const T {
2491
860
        self.0.as_ptr()
2492
860
    }
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<parking_lot_core::thread_parker::imp::UnparkHandle>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_attributes::search::Match>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_attributes::search::TrackedAssignment>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::as_ptr
<smallvec::ConstNonNull<gix_attributes::search::TrackedAssignment>>::as_ptr
Line
Count
Source
2490
3.32M
    fn as_ptr(self) -> *const T {
2491
3.32M
        self.0.as_ptr()
2492
3.32M
    }
Unexecuted instantiation: <smallvec::ConstNonNull<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_hash::object_id::ObjectId>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<gix_attributes::search::TrackedAssignment>>::as_ptr
Unexecuted instantiation: <smallvec::ConstNonNull<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::as_ptr
2493
}
2494
2495
impl<T> Clone for ConstNonNull<T> {
2496
    #[inline]
2497
    fn clone(&self) -> Self {
2498
        *self
2499
    }
2500
}
2501
2502
impl<T> Copy for ConstNonNull<T> {}
2503
2504
#[cfg(feature = "impl_bincode")]
2505
use bincode::{
2506
    de::{BorrowDecoder, Decode, Decoder, read::Reader},
2507
    enc::{Encode, Encoder, write::Writer},
2508
    error::{DecodeError, EncodeError},
2509
    BorrowDecode,
2510
};
2511
2512
#[cfg(feature = "impl_bincode")]
2513
impl<A, Context> Decode<Context> for SmallVec<A>
2514
where
2515
    A: Array,
2516
    A::Item: Decode<Context>,
2517
{
2518
    fn decode<D: Decoder<Context = Context>>(decoder: &mut D) -> Result<Self, DecodeError> {
2519
        use core::convert::TryInto;
2520
        let len = u64::decode(decoder)?;
2521
        let len = len.try_into().map_err(|_| DecodeError::OutsideUsizeRange(len))?;
2522
        decoder.claim_container_read::<A::Item>(len)?;
2523
2524
        let mut vec = SmallVec::with_capacity(len);
2525
        if unty::type_equal::<A::Item, u8>() {
2526
            // Initialize the smallvec's buffer.  Note that we need to do this through
2527
            // the raw pointer as we cannot name the type [u8; N] even though A::Item is u8.
2528
            let ptr = vec.as_mut_ptr();
2529
            // SAFETY: A::Item is u8 and the smallvec has been allocated with enough capacity
2530
            unsafe {
2531
                core::ptr::write_bytes(ptr, 0, len);
2532
                vec.set_len(len);
2533
            }
2534
            // Read the data into the smallvec's buffer.
2535
            let slice = vec.as_mut_slice();
2536
            // SAFETY: A::Item is u8
2537
            let slice = unsafe { core::mem::transmute::<&mut [A::Item], &mut [u8]>(slice) };
2538
            decoder.reader().read(slice)?;
2539
        } else {
2540
            for _ in 0..len {
2541
                decoder.unclaim_bytes_read(core::mem::size_of::<A::Item>());
2542
                vec.push(A::Item::decode(decoder)?);
2543
            }
2544
        }
2545
        Ok(vec)
2546
    }
2547
}
2548
2549
#[cfg(feature = "impl_bincode")]
2550
impl<'de, A, Context> BorrowDecode<'de, Context> for SmallVec<A>
2551
where
2552
    A: Array,
2553
    A::Item: BorrowDecode<'de, Context>,
2554
{
2555
    fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>(decoder: &mut D) -> Result<Self, DecodeError> {
2556
        use core::convert::TryInto;
2557
        let len = u64::decode(decoder)?;
2558
        let len = len.try_into().map_err(|_| DecodeError::OutsideUsizeRange(len))?;
2559
        decoder.claim_container_read::<A::Item>(len)?;
2560
2561
        let mut vec = SmallVec::with_capacity(len);
2562
        if unty::type_equal::<A::Item, u8>() {
2563
            // Initialize the smallvec's buffer.  Note that we need to do this through
2564
            // the raw pointer as we cannot name the type [u8; N] even though A::Item is u8.
2565
            let ptr = vec.as_mut_ptr();
2566
            // SAFETY: A::Item is u8 and the smallvec has been allocated with enough capacity
2567
            unsafe {
2568
                core::ptr::write_bytes(ptr, 0, len);
2569
                vec.set_len(len);
2570
            }
2571
            // Read the data into the smallvec's buffer.
2572
            let slice = vec.as_mut_slice();
2573
            // SAFETY: A::Item is u8
2574
            let slice = unsafe { core::mem::transmute::<&mut [A::Item], &mut [u8]>(slice) };
2575
            decoder.reader().read(slice)?;
2576
        } else {
2577
            for _ in 0..len {
2578
                decoder.unclaim_bytes_read(core::mem::size_of::<A::Item>());
2579
                vec.push(A::Item::borrow_decode(decoder)?);
2580
            }
2581
        }
2582
        Ok(vec)
2583
    }
2584
}
2585
2586
#[cfg(feature = "impl_bincode")]
2587
impl<A> Encode for SmallVec<A>
2588
where
2589
    A: Array,
2590
    A::Item: Encode,
2591
{
2592
    fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError> {
2593
        (self.len() as u64).encode(encoder)?;
2594
        if unty::type_equal::<A::Item, u8>() {
2595
            // Safety: A::Item is u8
2596
            let slice: &[u8] = unsafe { core::mem::transmute(self.as_slice()) };
2597
            encoder.writer().write(slice)?;
2598
        } else {
2599
            for item in self.iter() {
2600
                item.encode(encoder)?;
2601
            }
2602
        }
2603
        Ok(())
2604
    }
2605
}