/rust/registry/src/index.crates.io-1949cf8c6b5b557f/smallvec-1.15.2/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<[_; 10]> = 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 | 319k | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { |
323 | 0 | match result { |
324 | 319k | 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 | 319k | } smallvec::infallible::<()> Line | Count | Source | 322 | 6.18k | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 6.18k | 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.18k | } |
smallvec::infallible::<()> Line | Count | Source | 322 | 69.4k | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 69.4k | 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 | 69.4k | } |
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 | 462 | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 462 | 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 | 462 | } |
smallvec::infallible::<()> Line | Count | Source | 322 | 25.4k | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 25.4k | 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 | 25.4k | } |
smallvec::infallible::<()> Line | Count | Source | 322 | 179k | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 179k | 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 | 179k | } |
Unexecuted instantiation: smallvec::infallible::<()> Unexecuted instantiation: smallvec::infallible::<()> smallvec::infallible::<()> Line | Count | Source | 322 | 940 | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 940 | 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 | 940 | } |
smallvec::infallible::<()> Line | Count | Source | 322 | 856 | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 856 | 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 | 856 | } |
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 | 36.6k | fn infallible<T>(result: Result<T, CollectionAllocErr>) -> T { | 323 | 0 | match result { | 324 | 36.6k | 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 | 36.6k | } |
Unexecuted instantiation: smallvec::infallible::<()> 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 | 17.7k | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { |
333 | 17.7k | let size = mem::size_of::<T>() |
334 | 17.7k | .checked_mul(n) |
335 | 17.7k | .ok_or(CollectionAllocErr::CapacityOverflow)?; |
336 | 17.7k | let align = mem::align_of::<T>(); |
337 | 17.7k | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) |
338 | 17.7k | } smallvec::layout_array::<gix_config::parse::Event> Line | Count | Source | 332 | 361 | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 361 | let size = mem::size_of::<T>() | 334 | 361 | .checked_mul(n) | 335 | 361 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 361 | let align = mem::align_of::<T>(); | 337 | 361 | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 361 | } |
smallvec::layout_array::<gix_config::parse::Event> Line | Count | Source | 332 | 1.93k | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 1.93k | let size = mem::size_of::<T>() | 334 | 1.93k | .checked_mul(n) | 335 | 1.93k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 1.93k | let align = mem::align_of::<T>(); | 337 | 1.93k | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 1.93k | } |
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::<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_pack::data::file::decode::entry::Delta> Unexecuted instantiation: smallvec::layout_array::<(gix_hash::object_id::ObjectId, i64)> 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_hash::object_id::ObjectId> smallvec::layout_array::<&bstr::bstr::BStr> Line | Count | Source | 332 | 803 | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 803 | let size = mem::size_of::<T>() | 334 | 803 | .checked_mul(n) | 335 | 803 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 803 | let align = mem::align_of::<T>(); | 337 | 803 | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 803 | } |
Unexecuted instantiation: smallvec::layout_array::<u8> smallvec::layout_array::<u8> Line | Count | Source | 332 | 1.32k | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 1.32k | let size = mem::size_of::<T>() | 334 | 1.32k | .checked_mul(n) | 335 | 1.32k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 1.32k | let align = mem::align_of::<T>(); | 337 | 1.32k | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 1.32k | } |
smallvec::layout_array::<u8> Line | Count | Source | 332 | 4.48k | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 4.48k | let size = mem::size_of::<T>() | 334 | 4.48k | .checked_mul(n) | 335 | 4.48k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 4.48k | let align = mem::align_of::<T>(); | 337 | 4.48k | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 4.48k | } |
Unexecuted instantiation: smallvec::layout_array::<(gix_hash::object_id::ObjectId, i64)> Unexecuted instantiation: smallvec::layout_array::<gix_hash::object_id::ObjectId> Unexecuted instantiation: smallvec::layout_array::<&bstr::bstr::BStr> Unexecuted instantiation: smallvec::layout_array::<u8> smallvec::layout_array::<u8> Line | Count | Source | 332 | 219 | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 219 | let size = mem::size_of::<T>() | 334 | 219 | .checked_mul(n) | 335 | 219 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 219 | let align = mem::align_of::<T>(); | 337 | 219 | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 219 | } |
smallvec::layout_array::<gix_pack::data::file::decode::entry::Delta> Line | Count | Source | 332 | 1.53k | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 1.53k | let size = mem::size_of::<T>() | 334 | 1.53k | .checked_mul(n) | 335 | 1.53k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 1.53k | let align = mem::align_of::<T>(); | 337 | 1.53k | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 1.53k | } |
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::<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 | 6.03k | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 6.03k | let size = mem::size_of::<T>() | 334 | 6.03k | .checked_mul(n) | 335 | 6.03k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 6.03k | let align = mem::align_of::<T>(); | 337 | 6.03k | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 6.03k | } |
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 | 1.07k | fn layout_array<T>(n: usize) -> Result<Layout, CollectionAllocErr> { | 333 | 1.07k | let size = mem::size_of::<T>() | 334 | 1.07k | .checked_mul(n) | 335 | 1.07k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 336 | 1.07k | let align = mem::align_of::<T>(); | 337 | 1.07k | Layout::from_size_align(size, align).map_err(|_| CollectionAllocErr::CapacityOverflow) | 338 | 1.07k | } |
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_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>)> |
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::<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_pack::data::file::decode::entry::Delta> Unexecuted instantiation: smallvec::deallocate::<(gix_hash::object_id::ObjectId, i64)> 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_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::<(gix_hash::object_id::ObjectId, i64)> 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_pack::data::file::decode::entry::Delta> 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::<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_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>)> |
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::Item>() != 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 | | // Workaround for https://github.com/rust-lang/rust/issues/157743: when from_inline is |
655 | | // called with MaybeUninit::uninit(), rustc 1.93+ GVN propagates const <uninit> into the |
656 | | // ManuallyDrop::new() aggregate, causing LLVM to materialize a global constant that |
657 | | // MemCpyOpt then collapses into a memset over the whole struct. Using assume_init() of a |
658 | | // doubly-wrapped MaybeUninit produces Immediate::Uninit instead of const <uninit>, which |
659 | | // codegen handles as undef without emitting any global. This function also avoids |
660 | | // introducing an intermediate local that would inflate stack frames in debug builds. |
661 | | #[inline] |
662 | | fn empty() -> SmallVecData<A> { |
663 | | // SAFETY: ManuallyDrop<MaybeUninit<A>> is valid for any bit pattern including |
664 | | // uninitialized bytes, so assume_init() on a MaybeUninit of that type is sound. |
665 | | SmallVecData { inline: unsafe { MaybeUninit::uninit().assume_init() } } |
666 | | } |
667 | | #[inline] |
668 | | unsafe fn into_inline(self) -> MaybeUninit<A> { |
669 | | core::mem::ManuallyDrop::into_inner(self.inline) |
670 | | } |
671 | | #[inline] |
672 | | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { |
673 | | (ConstNonNull(self.heap.0), self.heap.1) |
674 | | } |
675 | | #[inline] |
676 | | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { |
677 | | let h = &mut self.heap; |
678 | | (h.0, &mut h.1) |
679 | | } |
680 | | #[inline] |
681 | | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { |
682 | | SmallVecData { heap: (ptr, len) } |
683 | | } |
684 | | } |
685 | | |
686 | | #[cfg(not(feature = "union"))] |
687 | | enum SmallVecData<A: Array> { |
688 | | Inline(MaybeUninit<A>), |
689 | | // Using NonNull and NonZero here allows to reduce size of `SmallVec`. |
690 | | Heap { |
691 | | // Since we never allocate on heap |
692 | | // unless our capacity is bigger than inline capacity |
693 | | // heap capacity cannot be less than 1. |
694 | | // Therefore, pointer cannot be null too. |
695 | | ptr: NonNull<A::Item>, |
696 | | len: usize, |
697 | | }, |
698 | | } |
699 | | |
700 | | #[cfg(all(not(feature = "union"), feature = "const_new"))] |
701 | | impl<T, const N: usize> SmallVecData<[T; N]> { |
702 | | #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))] |
703 | | #[inline] |
704 | | const fn from_const(inline: MaybeUninit<[T; N]>) -> Self { |
705 | | SmallVecData::Inline(inline) |
706 | | } |
707 | | } |
708 | | |
709 | | #[cfg(not(feature = "union"))] |
710 | | impl<A: Array> SmallVecData<A> { |
711 | | #[inline] |
712 | 968k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { |
713 | 968k | match self { |
714 | 968k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), |
715 | 0 | _ => debug_unreachable!(), |
716 | | } |
717 | 968k | } <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline Line | Count | Source | 712 | 5.82k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 5.82k | match self { | 714 | 5.82k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 5.82k | } |
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline Line | Count | Source | 712 | 83.7k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 83.7k | match self { | 714 | 83.7k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 83.7k | } |
<smallvec::SmallVecData<[u8; 2]>>::inline Line | Count | Source | 712 | 67.7k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 67.7k | match self { | 714 | 67.7k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 67.7k | } |
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<[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_pack::data::file::decode::entry::Delta; 10]>>::inline Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::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_hash::object_id::ObjectId; 1]>>::inline <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline Line | Count | Source | 712 | 363 | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 363 | match self { | 714 | 363 | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 363 | } |
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline <smallvec::SmallVecData<[u8; 23]>>::inline Line | Count | Source | 712 | 67.1k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 67.1k | match self { | 714 | 67.1k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 67.1k | } |
<smallvec::SmallVecData<[u8; 23]>>::inline Line | Count | Source | 712 | 656k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 656k | match self { | 714 | 656k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 656k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::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 <smallvec::SmallVecData<[u8; 256]>>::inline Line | Count | Source | 712 | 1.00k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 1.00k | match self { | 714 | 1.00k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 1.00k | } |
<smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::inline Line | Count | Source | 712 | 4.94k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 4.94k | match self { | 714 | 4.94k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 4.94k | } |
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<[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 | 712 | 61.8k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 61.8k | match self { | 714 | 61.8k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 61.8k | } |
<smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline Line | Count | Source | 712 | 18.1k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 18.1k | match self { | 714 | 18.1k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 18.1k | } |
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline Line | Count | Source | 712 | 1.19k | unsafe fn inline(&self) -> ConstNonNull<A::Item> { | 713 | 1.19k | match self { | 714 | 1.19k | SmallVecData::Inline(a) => ConstNonNull::new(a.as_ptr() as *const A::Item).unwrap(), | 715 | 0 | _ => debug_unreachable!(), | 716 | | } | 717 | 1.19k | } |
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_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 |
718 | | #[inline] |
719 | 1.05M | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { |
720 | 1.05M | match self { |
721 | 1.05M | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), |
722 | 0 | _ => debug_unreachable!(), |
723 | | } |
724 | 1.05M | } <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline_mut Line | Count | Source | 719 | 36.4k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 36.4k | match self { | 721 | 36.4k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 36.4k | } |
<smallvec::SmallVecData<[u8; 2]>>::inline_mut Line | Count | Source | 719 | 42.0k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 42.0k | match self { | 721 | 42.0k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 42.0k | } |
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline_mut Line | Count | Source | 719 | 74.5k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 74.5k | match self { | 721 | 74.5k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 74.5k | } |
<smallvec::SmallVecData<[u8; 2]>>::inline_mut Line | Count | Source | 719 | 102k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 102k | match self { | 721 | 102k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 102k | } |
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; 28]>>::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 Unexecuted instantiation: <smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::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<[gix_hash::object_id::ObjectId; 1]>>::inline_mut Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline_mut <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::inline_mut Line | Count | Source | 719 | 6.35k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 6.35k | match self { | 721 | 6.35k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 6.35k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::inline_mut <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut Line | Count | Source | 719 | 2.18k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 2.18k | match self { | 721 | 2.18k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 2.18k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline_mut <smallvec::SmallVecData<[u8; 23]>>::inline_mut Line | Count | Source | 719 | 123k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 123k | match self { | 721 | 123k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 123k | } |
<smallvec::SmallVecData<[u8; 23]>>::inline_mut Line | Count | Source | 719 | 487k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 487k | match self { | 721 | 487k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 487k | } |
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<[gix_hash::object_id::ObjectId; 1]>>::inline_mut Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::inline_mut <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::inline_mut Line | Count | Source | 719 | 270 | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 270 | match self { | 721 | 270 | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 270 | } |
<smallvec::SmallVecData<[u8; 256]>>::inline_mut Line | Count | Source | 719 | 1.94k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 1.94k | match self { | 721 | 1.94k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 1.94k | } |
<smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::inline_mut Line | Count | Source | 719 | 14.0k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 14.0k | match self { | 721 | 14.0k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 14.0k | } |
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 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; 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 | 719 | 46.3k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 46.3k | match self { | 721 | 46.3k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 46.3k | } |
<smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut Line | Count | Source | 719 | 6.92k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 6.92k | match self { | 721 | 6.92k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 6.92k | } |
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut Line | Count | Source | 719 | 6.52k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 6.52k | match self { | 721 | 6.52k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 6.52k | } |
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::inline_mut Line | Count | Source | 719 | 80.0k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 80.0k | match self { | 721 | 80.0k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 80.0k | } |
<smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_mut Line | Count | Source | 719 | 4.55k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 4.55k | match self { | 721 | 4.55k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 4.55k | } |
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_mut Line | Count | Source | 719 | 16.8k | unsafe fn inline_mut(&mut self) -> NonNull<A::Item> { | 720 | 16.8k | match self { | 721 | 16.8k | SmallVecData::Inline(a) => NonNull::new(a.as_mut_ptr() as *mut A::Item).unwrap(), | 722 | 0 | _ => debug_unreachable!(), | 723 | | } | 724 | 16.8k | } |
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_hash::object_id::ObjectId; 1]>>::inline_mut Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::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 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 |
725 | | #[inline] |
726 | | fn from_inline(inline: MaybeUninit<A>) -> SmallVecData<A> { |
727 | | SmallVecData::Inline(inline) |
728 | | } |
729 | | // See the comment on the union variant's empty() for why this exists. |
730 | | #[inline] |
731 | 387k | fn empty() -> SmallVecData<A> { |
732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, |
733 | | // so assume_init() on a MaybeUninit of that type is sound. |
734 | 387k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) |
735 | 387k | } <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::empty Line | Count | Source | 731 | 18.4k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 18.4k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 18.4k | } |
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::empty Line | Count | Source | 731 | 45.0k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 45.0k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 45.0k | } |
<smallvec::SmallVecData<[u8; 2]>>::empty Line | Count | Source | 731 | 48.2k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 48.2k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 48.2k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::empty Line | Count | Source | 731 | 2.19k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 2.19k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 2.19k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::empty <smallvec::SmallVecData<[u8; 23]>>::empty Line | Count | Source | 731 | 25.4k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 25.4k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 25.4k | } |
<smallvec::SmallVecData<[u8; 23]>>::empty Line | Count | Source | 731 | 179k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 179k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 179k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::empty <smallvec::SmallVecData<[u8; 256]>>::empty Line | Count | Source | 731 | 470 | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 470 | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 470 | } |
<smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::empty Line | Count | Source | 731 | 3.74k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 3.74k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 3.74k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(*const parking_lot_core::parking_lot::ThreadData, core::option::Option<parking_lot_core::thread_parker::imp::UnparkHandle>); 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[u8; 23]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 2]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[parking_lot_core::thread_parker::imp::UnparkHandle; 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::Match; 6]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Line | Count | Source | 731 | 6.92k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 6.92k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 6.92k | } |
<smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty Line | Count | Source | 731 | 6.92k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 6.92k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 6.92k | } |
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::empty Line | Count | Source | 731 | 49.8k | fn empty() -> SmallVecData<A> { | 732 | | // SAFETY: MaybeUninit<A> is valid for any bit pattern including uninitialized bytes, | 733 | | // so assume_init() on a MaybeUninit of that type is sound. | 734 | 49.8k | SmallVecData::Inline(unsafe { MaybeUninit::uninit().assume_init() }) | 735 | 49.8k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[core::result::Result<gix_hash::object_id::ObjectId, gix_revwalk::graph::commit::iter_parents::Error>; 2]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::empty Unexecuted instantiation: <smallvec::SmallVecData<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::empty |
736 | | #[inline] |
737 | | unsafe fn into_inline(self) -> MaybeUninit<A> { |
738 | | match self { |
739 | | SmallVecData::Inline(a) => a, |
740 | | _ => debug_unreachable!(), |
741 | | } |
742 | | } |
743 | | #[inline] |
744 | 9.17M | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { |
745 | 9.17M | match self { |
746 | 9.17M | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), |
747 | 0 | _ => debug_unreachable!(), |
748 | | } |
749 | 9.17M | } <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap Line | Count | Source | 744 | 361 | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 361 | match self { | 746 | 361 | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 361 | } |
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap Line | Count | Source | 744 | 9.14M | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 9.14M | match self { | 746 | 9.14M | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 9.14M | } |
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<[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_pack::data::file::decode::entry::Delta; 10]>>::heap Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 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<[gix_hash::object_id::ObjectId; 1]>>::heap <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap Line | Count | Source | 744 | 1.02k | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 1.02k | match self { | 746 | 1.02k | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 1.02k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap <smallvec::SmallVecData<[u8; 23]>>::heap Line | Count | Source | 744 | 3.29k | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 3.29k | match self { | 746 | 3.29k | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 3.29k | } |
<smallvec::SmallVecData<[u8; 23]>>::heap Line | Count | Source | 744 | 15.3k | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 15.3k | match self { | 746 | 15.3k | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 15.3k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 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 <smallvec::SmallVecData<[u8; 256]>>::heap Line | Count | Source | 744 | 876 | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 876 | match self { | 746 | 876 | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 876 | } |
<smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::heap Line | Count | Source | 744 | 2.16k | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 2.16k | match self { | 746 | 2.16k | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 2.16k | } |
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<[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 | 744 | 9.85k | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 9.85k | match self { | 746 | 9.85k | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 9.85k | } |
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 | 744 | 1.01k | unsafe fn heap(&self) -> (ConstNonNull<A::Item>, usize) { | 745 | 1.01k | match self { | 746 | 1.01k | SmallVecData::Heap { ptr, len } => (ConstNonNull(*ptr), *len), | 747 | 0 | _ => debug_unreachable!(), | 748 | | } | 749 | 1.01k | } |
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_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 |
750 | | #[inline] |
751 | 783k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { |
752 | 783k | match self { |
753 | 783k | SmallVecData::Heap { ptr, len } => (*ptr, len), |
754 | 0 | _ => debug_unreachable!(), |
755 | | } |
756 | 783k | } <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap_mut Line | Count | Source | 751 | 1.47k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 1.47k | match self { | 753 | 1.47k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 1.47k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 2]>>::heap_mut <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap_mut Line | Count | Source | 751 | 3.08k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 3.08k | match self { | 753 | 3.08k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 3.08k | } |
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; 28]>>::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 Unexecuted instantiation: <smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::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<[gix_hash::object_id::ObjectId; 1]>>::heap_mut Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap_mut <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::heap_mut Line | Count | Source | 751 | 215 | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 215 | match self { | 753 | 215 | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 215 | } |
Unexecuted instantiation: <smallvec::SmallVecData<[gix_hash::object_id::ObjectId; 1]>>::heap_mut <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut Line | Count | Source | 751 | 8.35k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 8.35k | match self { | 753 | 8.35k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 8.35k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap_mut <smallvec::SmallVecData<[u8; 23]>>::heap_mut Line | Count | Source | 751 | 5.28k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 5.28k | match self { | 753 | 5.28k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 5.28k | } |
<smallvec::SmallVecData<[u8; 23]>>::heap_mut Line | Count | Source | 751 | 6.33k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 6.33k | match self { | 753 | 6.33k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 6.33k | } |
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<[gix_hash::object_id::ObjectId; 1]>>::heap_mut Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::heap_mut <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::heap_mut Line | Count | Source | 751 | 7 | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 7 | match self { | 753 | 7 | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 7 | } |
<smallvec::SmallVecData<[u8; 256]>>::heap_mut Line | Count | Source | 751 | 1.09k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 1.09k | match self { | 753 | 1.09k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 1.09k | } |
<smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::heap_mut Line | Count | Source | 751 | 715k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 715k | match self { | 753 | 715k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 715k | } |
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 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; 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 | 751 | 1.89k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 1.89k | match self { | 753 | 1.89k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 1.89k | } |
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 | 751 | 397 | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 397 | match self { | 753 | 397 | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 397 | } |
<smallvec::SmallVecData<[gix_attributes::search::TrackedAssignment; 3]>>::heap_mut Line | Count | Source | 751 | 21.1k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 21.1k | match self { | 753 | 21.1k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 21.1k | } |
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 | 751 | 18.3k | unsafe fn heap_mut(&mut self) -> (NonNull<A::Item>, &mut usize) { | 752 | 18.3k | match self { | 753 | 18.3k | SmallVecData::Heap { ptr, len } => (*ptr, len), | 754 | 0 | _ => debug_unreachable!(), | 755 | | } | 756 | 18.3k | } |
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_hash::object_id::ObjectId; 1]>>::heap_mut Unexecuted instantiation: <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::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 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 |
757 | | #[inline] |
758 | 14.0k | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { |
759 | 14.0k | SmallVecData::Heap { ptr, len } |
760 | 14.0k | } <smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::from_heap Line | Count | Source | 758 | 361 | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 361 | SmallVecData::Heap { ptr, len } | 760 | 361 | } |
<smallvec::SmallVecData<[gix_config::parse::Event; 8]>>::from_heap Line | Count | Source | 758 | 1.64k | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 1.64k | SmallVecData::Heap { ptr, len } | 760 | 1.64k | } |
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<[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_pack::data::file::decode::entry::Delta; 10]>>::from_heap Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 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<[gix_hash::object_id::ObjectId; 1]>>::from_heap <smallvec::SmallVecData<[&bstr::bstr::BStr; 1]>>::from_heap Line | Count | Source | 758 | 462 | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 462 | SmallVecData::Heap { ptr, len } | 760 | 462 | } |
Unexecuted instantiation: <smallvec::SmallVecData<[u8; 28]>>::from_heap <smallvec::SmallVecData<[u8; 23]>>::from_heap Line | Count | Source | 758 | 1.32k | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 1.32k | SmallVecData::Heap { ptr, len } | 760 | 1.32k | } |
<smallvec::SmallVecData<[u8; 23]>>::from_heap Line | Count | Source | 758 | 4.48k | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 4.48k | SmallVecData::Heap { ptr, len } | 760 | 4.48k | } |
Unexecuted instantiation: <smallvec::SmallVecData<[(gix_hash::object_id::ObjectId, i64); 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 <smallvec::SmallVecData<[u8; 256]>>::from_heap Line | Count | Source | 758 | 219 | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 219 | SmallVecData::Heap { ptr, len } | 760 | 219 | } |
<smallvec::SmallVecData<[gix_pack::data::file::decode::entry::Delta; 10]>>::from_heap Line | Count | Source | 758 | 856 | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 856 | SmallVecData::Heap { ptr, len } | 760 | 856 | } |
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 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 | 758 | 4.00k | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 4.00k | SmallVecData::Heap { ptr, len } | 760 | 4.00k | } |
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 | 758 | 735 | fn from_heap(ptr: NonNull<A::Item>, len: usize) -> SmallVecData<A> { | 759 | 735 | SmallVecData::Heap { ptr, len } | 760 | 735 | } |
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_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 |
761 | | } |
762 | | |
763 | | unsafe impl<A: Array + Send> Send for SmallVecData<A> {} |
764 | | unsafe impl<A: Array + Sync> Sync for SmallVecData<A> {} |
765 | | |
766 | | /// A `Vec`-like container that can store a small number of elements inline. |
767 | | /// |
768 | | /// `SmallVec` acts like a vector, but can store a limited amount of data inline within the |
769 | | /// `SmallVec` struct rather than in a separate allocation. If the data exceeds this limit, the |
770 | | /// `SmallVec` will "spill" its data onto the heap, allocating a new buffer to hold it. |
771 | | /// |
772 | | /// The amount of data that a `SmallVec` can store inline depends on its backing store. The backing |
773 | | /// store can be any type that implements the `Array` trait; usually it is a small fixed-sized |
774 | | /// array. For example a `SmallVec<[u64; 8]>` can hold up to eight 64-bit integers inline. |
775 | | /// |
776 | | /// ## Example |
777 | | /// |
778 | | /// ```rust |
779 | | /// use smallvec::SmallVec; |
780 | | /// let mut v = SmallVec::<[u8; 4]>::new(); // initialize an empty vector |
781 | | /// |
782 | | /// // The vector can hold up to 4 items without spilling onto the heap. |
783 | | /// v.extend(0..4); |
784 | | /// assert_eq!(v.len(), 4); |
785 | | /// assert!(!v.spilled()); |
786 | | /// |
787 | | /// // Pushing another element will force the buffer to spill: |
788 | | /// v.push(4); |
789 | | /// assert_eq!(v.len(), 5); |
790 | | /// assert!(v.spilled()); |
791 | | /// ``` |
792 | | pub struct SmallVec<A: Array> { |
793 | | // The capacity field is used to determine which of the storage variants is active: |
794 | | // 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). |
795 | | // If capacity > Self::inline_capacity() then the heap variant is used and capacity holds the size of the memory allocation. |
796 | | capacity: usize, |
797 | | data: SmallVecData<A>, |
798 | | } |
799 | | |
800 | | impl<A: Array> SmallVec<A> { |
801 | | /// Construct an empty vector |
802 | | #[inline] |
803 | 387k | pub fn new() -> SmallVec<A> { |
804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, |
805 | | // this check should be optimized away entirely for valid ones. |
806 | 387k | assert!( |
807 | 387k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() |
808 | 387k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() |
809 | | ); |
810 | 387k | SmallVec { |
811 | 387k | capacity: 0, |
812 | 387k | data: SmallVecData::empty(), |
813 | 387k | } |
814 | 387k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::new Line | Count | Source | 803 | 18.4k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 18.4k | assert!( | 807 | 18.4k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 18.4k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 18.4k | SmallVec { | 811 | 18.4k | capacity: 0, | 812 | 18.4k | data: SmallVecData::empty(), | 813 | 18.4k | } | 814 | 18.4k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::new Line | Count | Source | 803 | 45.0k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 45.0k | assert!( | 807 | 45.0k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 45.0k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 45.0k | SmallVec { | 811 | 45.0k | capacity: 0, | 812 | 45.0k | data: SmallVecData::empty(), | 813 | 45.0k | } | 814 | 45.0k | } |
<smallvec::SmallVec<[u8; 2]>>::new Line | Count | Source | 803 | 48.2k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 48.2k | assert!( | 807 | 48.2k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 48.2k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 48.2k | SmallVec { | 811 | 48.2k | capacity: 0, | 812 | 48.2k | data: SmallVecData::empty(), | 813 | 48.2k | } | 814 | 48.2k | } |
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; 28]>>::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_pack::data::file::decode::entry::Delta; 10]>>::new Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::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; 28]>>::new Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::new <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::new Line | Count | Source | 803 | 2.19k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 2.19k | assert!( | 807 | 2.19k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 2.19k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 2.19k | SmallVec { | 811 | 2.19k | capacity: 0, | 812 | 2.19k | data: SmallVecData::empty(), | 813 | 2.19k | } | 814 | 2.19k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::new <smallvec::SmallVec<[u8; 23]>>::new Line | Count | Source | 803 | 25.4k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 25.4k | assert!( | 807 | 25.4k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 25.4k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 25.4k | SmallVec { | 811 | 25.4k | capacity: 0, | 812 | 25.4k | data: SmallVecData::empty(), | 813 | 25.4k | } | 814 | 25.4k | } |
<smallvec::SmallVec<[u8; 23]>>::new Line | Count | Source | 803 | 179k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 179k | assert!( | 807 | 179k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 179k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 179k | SmallVec { | 811 | 179k | capacity: 0, | 812 | 179k | data: SmallVecData::empty(), | 813 | 179k | } | 814 | 179k | } |
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::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; 28]>>::new <smallvec::SmallVec<[u8; 256]>>::new Line | Count | Source | 803 | 470 | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 470 | assert!( | 807 | 470 | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 470 | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 470 | SmallVec { | 811 | 470 | capacity: 0, | 812 | 470 | data: SmallVecData::empty(), | 813 | 470 | } | 814 | 470 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::new Line | Count | Source | 803 | 3.74k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 3.74k | assert!( | 807 | 3.74k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 3.74k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 3.74k | SmallVec { | 811 | 3.74k | capacity: 0, | 812 | 3.74k | data: SmallVecData::empty(), | 813 | 3.74k | } | 814 | 3.74k | } |
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<[(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; 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 | 803 | 6.92k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 6.92k | assert!( | 807 | 6.92k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 6.92k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 6.92k | SmallVec { | 811 | 6.92k | capacity: 0, | 812 | 6.92k | data: SmallVecData::empty(), | 813 | 6.92k | } | 814 | 6.92k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::new Line | Count | Source | 803 | 6.92k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 6.92k | assert!( | 807 | 6.92k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 6.92k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 6.92k | SmallVec { | 811 | 6.92k | capacity: 0, | 812 | 6.92k | data: SmallVecData::empty(), | 813 | 6.92k | } | 814 | 6.92k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::new Line | Count | Source | 803 | 49.8k | pub fn new() -> SmallVec<A> { | 804 | | // Try to detect invalid custom implementations of `Array`. Hopefully, | 805 | | // this check should be optimized away entirely for valid ones. | 806 | 49.8k | assert!( | 807 | 49.8k | mem::size_of::<A>() == A::size() * mem::size_of::<A::Item>() | 808 | 49.8k | && mem::align_of::<A>() >= mem::align_of::<A::Item>() | 809 | | ); | 810 | 49.8k | SmallVec { | 811 | 49.8k | capacity: 0, | 812 | 49.8k | data: SmallVecData::empty(), | 813 | 49.8k | } | 814 | 49.8k | } |
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<[gix_hash::object_id::ObjectId; 1]>>::new Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::new Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::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 |
815 | | |
816 | | /// Construct an empty vector with enough capacity pre-allocated to store at least `n` |
817 | | /// elements. |
818 | | /// |
819 | | /// Will create a heap allocation only if `n` is larger than the inline capacity. |
820 | | /// |
821 | | /// ``` |
822 | | /// # use smallvec::SmallVec; |
823 | | /// |
824 | | /// let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(100); |
825 | | /// |
826 | | /// assert!(v.is_empty()); |
827 | | /// assert!(v.capacity() >= 100); |
828 | | /// ``` |
829 | | #[inline] |
830 | 470 | pub fn with_capacity(n: usize) -> Self { |
831 | 470 | let mut v = SmallVec::new(); |
832 | 470 | v.reserve_exact(n); |
833 | 470 | v |
834 | 470 | } |
835 | | |
836 | | /// Construct a new `SmallVec` from a `Vec<A::Item>`. |
837 | | /// |
838 | | /// Elements will be copied to the inline buffer if `vec.capacity() <= Self::inline_capacity()`. |
839 | | /// |
840 | | /// ```rust |
841 | | /// use smallvec::SmallVec; |
842 | | /// |
843 | | /// let vec = vec![1, 2, 3, 4, 5]; |
844 | | /// let small_vec: SmallVec<[_; 3]> = SmallVec::from_vec(vec); |
845 | | /// |
846 | | /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); |
847 | | /// ``` |
848 | | #[inline] |
849 | | pub fn from_vec(mut vec: Vec<A::Item>) -> SmallVec<A> { |
850 | | if vec.capacity() <= Self::inline_capacity() { |
851 | | // Cannot use Vec with smaller capacity |
852 | | // because we use value of `Self::capacity` field as indicator. |
853 | | unsafe { |
854 | | let mut data = SmallVecData::<A>::empty(); |
855 | | let len = vec.len(); |
856 | | vec.set_len(0); |
857 | | ptr::copy_nonoverlapping(vec.as_ptr(), data.inline_mut().as_ptr(), len); |
858 | | |
859 | | SmallVec { |
860 | | capacity: len, |
861 | | data, |
862 | | } |
863 | | } |
864 | | } else { |
865 | | let (ptr, cap, len) = (vec.as_mut_ptr(), vec.capacity(), vec.len()); |
866 | | mem::forget(vec); |
867 | | let ptr = NonNull::new(ptr) |
868 | | // See docs: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.as_mut_ptr |
869 | | .expect("Cannot be null by `Vec` invariant"); |
870 | | |
871 | | SmallVec { |
872 | | capacity: cap, |
873 | | data: SmallVecData::from_heap(ptr, len), |
874 | | } |
875 | | } |
876 | | } |
877 | | |
878 | | /// Constructs a new `SmallVec` on the stack from an `A` without |
879 | | /// copying elements. |
880 | | /// |
881 | | /// ```rust |
882 | | /// use smallvec::SmallVec; |
883 | | /// |
884 | | /// let buf = [1, 2, 3, 4, 5]; |
885 | | /// let small_vec: SmallVec<_> = SmallVec::from_buf(buf); |
886 | | /// |
887 | | /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); |
888 | | /// ``` |
889 | | #[inline] |
890 | | pub fn from_buf(buf: A) -> SmallVec<A> { |
891 | | SmallVec { |
892 | | capacity: A::size(), |
893 | | data: SmallVecData::from_inline(MaybeUninit::new(buf)), |
894 | | } |
895 | | } |
896 | | |
897 | | /// Constructs a new `SmallVec` on the stack from an `A` without |
898 | | /// copying elements. Also sets the length, which must be less or |
899 | | /// equal to the size of `buf`. |
900 | | /// |
901 | | /// ```rust |
902 | | /// use smallvec::SmallVec; |
903 | | /// |
904 | | /// let buf = [1, 2, 3, 4, 5, 0, 0, 0]; |
905 | | /// let small_vec: SmallVec<_> = SmallVec::from_buf_and_len(buf, 5); |
906 | | /// |
907 | | /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); |
908 | | /// ``` |
909 | | #[inline] |
910 | | pub fn from_buf_and_len(buf: A, len: usize) -> SmallVec<A> { |
911 | | assert!(len <= A::size()); |
912 | | unsafe { SmallVec::from_buf_and_len_unchecked(MaybeUninit::new(buf), len) } |
913 | | } |
914 | | |
915 | | /// Constructs a new `SmallVec` on the stack from an `A` without |
916 | | /// copying elements. Also sets the length. The user is responsible |
917 | | /// for ensuring that `len <= A::size()`. |
918 | | /// |
919 | | /// ```rust |
920 | | /// use smallvec::SmallVec; |
921 | | /// use std::mem::MaybeUninit; |
922 | | /// |
923 | | /// let buf = [1, 2, 3, 4, 5, 0, 0, 0]; |
924 | | /// let small_vec: SmallVec<_> = unsafe { |
925 | | /// SmallVec::from_buf_and_len_unchecked(MaybeUninit::new(buf), 5) |
926 | | /// }; |
927 | | /// |
928 | | /// assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); |
929 | | /// ``` |
930 | | #[inline] |
931 | | pub unsafe fn from_buf_and_len_unchecked(buf: MaybeUninit<A>, len: usize) -> SmallVec<A> { |
932 | | SmallVec { |
933 | | capacity: len, |
934 | | data: SmallVecData::from_inline(buf), |
935 | | } |
936 | | } |
937 | | |
938 | | /// Sets the length of a vector. |
939 | | /// |
940 | | /// This will explicitly set the size of the vector, without actually |
941 | | /// modifying its buffers, so it is up to the caller to ensure that the |
942 | | /// vector is actually the specified size. |
943 | 2.08k | pub unsafe fn set_len(&mut self, new_len: usize) { |
944 | 2.08k | let (_, len_ptr, _) = self.triple_mut(); |
945 | 2.08k | *len_ptr = new_len; |
946 | 2.08k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::set_len Line | Count | Source | 943 | 1.53k | pub unsafe fn set_len(&mut self, new_len: usize) { | 944 | 1.53k | let (_, len_ptr, _) = self.triple_mut(); | 945 | 1.53k | *len_ptr = new_len; | 946 | 1.53k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::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<[gix_pack::data::file::decode::entry::Delta; 10]>>::set_len Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len <smallvec::SmallVec<[u8; 256]>>::set_len Line | Count | Source | 943 | 470 | pub unsafe fn set_len(&mut self, new_len: usize) { | 944 | 470 | let (_, len_ptr, _) = self.triple_mut(); | 945 | 470 | *len_ptr = new_len; | 946 | 470 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::set_len Line | Count | Source | 943 | 72 | pub unsafe fn set_len(&mut self, new_len: usize) { | 944 | 72 | let (_, len_ptr, _) = self.triple_mut(); | 945 | 72 | *len_ptr = new_len; | 946 | 72 | } |
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<[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 Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::set_len |
947 | | |
948 | | /// The maximum number of elements this vector can hold inline |
949 | | #[inline] |
950 | 14.4M | fn inline_capacity() -> usize { |
951 | 14.4M | if mem::size_of::<A::Item>() > 0 { |
952 | 14.4M | A::size() |
953 | | } else { |
954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. |
955 | | // Therefore all items are at the same address, |
956 | | // and any array size has capacity for infinitely many items. |
957 | | // The capacity is limited by the bit width of the length field. |
958 | | // |
959 | | // `Vec` also does this: |
960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 |
961 | | // |
962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, |
963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. |
964 | 0 | core::usize::MAX |
965 | | } |
966 | 14.4M | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::inline_capacity Line | Count | Source | 950 | 111k | fn inline_capacity() -> usize { | 951 | 111k | if mem::size_of::<A::Item>() > 0 { | 952 | 111k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 111k | } |
<smallvec::SmallVec<[u8; 2]>>::inline_capacity Line | Count | Source | 950 | 126k | fn inline_capacity() -> usize { | 951 | 126k | if mem::size_of::<A::Item>() > 0 { | 952 | 126k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 126k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::inline_capacity Line | Count | Source | 950 | 9.49M | fn inline_capacity() -> usize { | 951 | 9.49M | if mem::size_of::<A::Item>() > 0 { | 952 | 9.49M | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 9.49M | } |
<smallvec::SmallVec<[u8; 2]>>::inline_capacity Line | Count | Source | 950 | 347k | fn inline_capacity() -> usize { | 951 | 347k | if mem::size_of::<A::Item>() > 0 { | 952 | 347k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 347k | } |
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; 28]>>::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 Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::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<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::inline_capacity <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::inline_capacity Line | Count | Source | 950 | 19.2k | fn inline_capacity() -> usize { | 951 | 19.2k | if mem::size_of::<A::Item>() > 0 { | 952 | 19.2k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 19.2k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity Line | Count | Source | 950 | 16.7k | fn inline_capacity() -> usize { | 951 | 16.7k | if mem::size_of::<A::Item>() > 0 { | 952 | 16.7k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 16.7k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::inline_capacity <smallvec::SmallVec<[u8; 23]>>::inline_capacity Line | Count | Source | 950 | 464k | fn inline_capacity() -> usize { | 951 | 464k | if mem::size_of::<A::Item>() > 0 { | 952 | 464k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 464k | } |
<smallvec::SmallVec<[u8; 23]>>::inline_capacity Line | Count | Source | 950 | 2.44M | fn inline_capacity() -> usize { | 951 | 2.44M | if mem::size_of::<A::Item>() > 0 { | 952 | 2.44M | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 2.44M | } |
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<[gix_hash::object_id::ObjectId; 1]>>::inline_capacity Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::inline_capacity <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::inline_capacity Line | Count | Source | 950 | 817 | fn inline_capacity() -> usize { | 951 | 817 | if mem::size_of::<A::Item>() > 0 { | 952 | 817 | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 817 | } |
<smallvec::SmallVec<[u8; 256]>>::inline_capacity Line | Count | Source | 950 | 8.55k | fn inline_capacity() -> usize { | 951 | 8.55k | if mem::size_of::<A::Item>() > 0 { | 952 | 8.55k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 8.55k | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::inline_capacity Line | Count | Source | 950 | 759k | fn inline_capacity() -> usize { | 951 | 759k | if mem::size_of::<A::Item>() > 0 { | 952 | 759k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 759k | } |
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 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; 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 | 950 | 141k | fn inline_capacity() -> usize { | 951 | 141k | if mem::size_of::<A::Item>() > 0 { | 952 | 141k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 141k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity Line | Count | Source | 950 | 20.7k | fn inline_capacity() -> usize { | 951 | 20.7k | if mem::size_of::<A::Item>() > 0 { | 952 | 20.7k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 20.7k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity Line | Count | Source | 950 | 19.9k | fn inline_capacity() -> usize { | 951 | 19.9k | if mem::size_of::<A::Item>() > 0 { | 952 | 19.9k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 19.9k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::inline_capacity Line | Count | Source | 950 | 320k | fn inline_capacity() -> usize { | 951 | 320k | if mem::size_of::<A::Item>() > 0 { | 952 | 320k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 320k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::inline_capacity Line | Count | Source | 950 | 45.3k | fn inline_capacity() -> usize { | 951 | 45.3k | if mem::size_of::<A::Item>() > 0 { | 952 | 45.3k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 45.3k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::inline_capacity Line | Count | Source | 950 | 56.0k | fn inline_capacity() -> usize { | 951 | 56.0k | if mem::size_of::<A::Item>() > 0 { | 952 | 56.0k | A::size() | 953 | | } else { | 954 | | // For zero-size items code like `ptr.add(offset)` always returns the same pointer. | 955 | | // Therefore all items are at the same address, | 956 | | // and any array size has capacity for infinitely many items. | 957 | | // The capacity is limited by the bit width of the length field. | 958 | | // | 959 | | // `Vec` also does this: | 960 | | // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 | 961 | | // | 962 | | // In our case, this also ensures that a smallvec of zero-size items never spills, | 963 | | // and we never try to allocate zero bytes which `std::alloc::alloc` disallows. | 964 | 0 | core::usize::MAX | 965 | | } | 966 | 56.0k | } |
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_hash::object_id::ObjectId; 1]>>::inline_capacity Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::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 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 |
967 | | |
968 | | /// The maximum number of elements this vector can hold inline |
969 | | #[inline] |
970 | | pub fn inline_size(&self) -> usize { |
971 | | Self::inline_capacity() |
972 | | } |
973 | | |
974 | | /// The number of elements stored in the vector |
975 | | #[inline] |
976 | 81.2k | pub fn len(&self) -> usize { |
977 | 81.2k | self.triple().1 |
978 | 81.2k | } Unexecuted instantiation: <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::len <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::len Line | Count | Source | 976 | 13.9k | pub fn len(&self) -> usize { | 977 | 13.9k | self.triple().1 | 978 | 13.9k | } |
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<[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_pack::data::file::decode::entry::Delta; 10]>>::len Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 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<[gix_hash::object_id::ObjectId; 1]>>::len <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::len Line | Count | Source | 976 | 924 | pub fn len(&self) -> usize { | 977 | 924 | self.triple().1 | 978 | 924 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::len <smallvec::SmallVec<[u8; 23]>>::len Line | Count | Source | 976 | 732 | pub fn len(&self) -> usize { | 977 | 732 | self.triple().1 | 978 | 732 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::len Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 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 <smallvec::SmallVec<[u8; 256]>>::len Line | Count | Source | 976 | 940 | pub fn len(&self) -> usize { | 977 | 940 | self.triple().1 | 978 | 940 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::len Line | Count | Source | 976 | 6.09k | pub fn len(&self) -> usize { | 977 | 6.09k | self.triple().1 | 978 | 6.09k | } |
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<[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 | 976 | 39.0k | pub fn len(&self) -> usize { | 977 | 39.0k | self.triple().1 | 978 | 39.0k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::len Line | Count | Source | 976 | 18.1k | pub fn len(&self) -> usize { | 977 | 18.1k | self.triple().1 | 978 | 18.1k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::len Line | Count | Source | 976 | 1.47k | pub fn len(&self) -> usize { | 977 | 1.47k | self.triple().1 | 978 | 1.47k | } |
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_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 |
979 | | |
980 | | /// Returns `true` if the vector is empty |
981 | | #[inline] |
982 | 61.7k | pub fn is_empty(&self) -> bool { |
983 | 61.7k | self.len() == 0 |
984 | 61.7k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::is_empty Line | Count | Source | 982 | 12.3k | pub fn is_empty(&self) -> bool { | 983 | 12.3k | self.len() == 0 | 984 | 12.3k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::is_empty <smallvec::SmallVec<[u8; 23]>>::is_empty Line | Count | Source | 982 | 732 | pub fn is_empty(&self) -> bool { | 983 | 732 | self.len() == 0 | 984 | 732 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::is_empty Line | Count | Source | 982 | 2.15k | pub fn is_empty(&self) -> bool { | 983 | 2.15k | self.len() == 0 | 984 | 2.15k | } |
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 | 982 | 28.3k | pub fn is_empty(&self) -> bool { | 983 | 28.3k | self.len() == 0 | 984 | 28.3k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::is_empty Line | Count | Source | 982 | 18.1k | pub fn is_empty(&self) -> bool { | 983 | 18.1k | self.len() == 0 | 984 | 18.1k | } |
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 |
985 | | |
986 | | /// The number of items the vector can hold without reallocating |
987 | | #[inline] |
988 | 5.44k | pub fn capacity(&self) -> usize { |
989 | 5.44k | self.triple().2 |
990 | 5.44k | } Unexecuted instantiation: <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::capacity <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::capacity Line | Count | Source | 988 | 27 | pub fn capacity(&self) -> usize { | 989 | 27 | self.triple().2 | 990 | 27 | } |
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_pack::data::file::decode::entry::Delta; 10]>>::capacity Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 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<[gix_hash::object_id::ObjectId; 1]>>::capacity <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::capacity Line | Count | Source | 988 | 462 | pub fn capacity(&self) -> usize { | 989 | 462 | self.triple().2 | 990 | 462 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::capacity Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::capacity Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::capacity Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::capacity Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::capacity <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::capacity Line | Count | Source | 988 | 856 | pub fn capacity(&self) -> usize { | 989 | 856 | self.triple().2 | 990 | 856 | } |
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<[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 | 988 | 3.36k | pub fn capacity(&self) -> usize { | 989 | 3.36k | self.triple().2 | 990 | 3.36k | } |
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 | 988 | 735 | pub fn capacity(&self) -> usize { | 989 | 735 | self.triple().2 | 990 | 735 | } |
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_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 |
991 | | |
992 | | /// Returns a tuple with (data ptr, len, capacity) |
993 | | /// Useful to get all `SmallVec` properties with a single check of the current storage variant. |
994 | | #[inline] |
995 | 10.1M | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { |
996 | | unsafe { |
997 | 10.1M | if self.spilled() { |
998 | 9.17M | let (ptr, len) = self.data.heap(); |
999 | 9.17M | (ptr, len, self.capacity) |
1000 | | } else { |
1001 | 968k | (self.data.inline(), self.capacity, Self::inline_capacity()) |
1002 | | } |
1003 | | } |
1004 | 10.1M | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple Line | Count | Source | 995 | 6.18k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 6.18k | if self.spilled() { | 998 | 361 | let (ptr, len) = self.data.heap(); | 999 | 361 | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 5.82k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 6.18k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple Line | Count | Source | 995 | 9.22M | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 9.22M | if self.spilled() { | 998 | 9.14M | let (ptr, len) = self.data.heap(); | 999 | 9.14M | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 83.7k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 9.22M | } |
<smallvec::SmallVec<[u8; 2]>>::triple Line | Count | Source | 995 | 67.7k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 67.7k | if self.spilled() { | 998 | 0 | let (ptr, len) = self.data.heap(); | 999 | 0 | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 67.7k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 67.7k | } |
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<[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_pack::data::file::decode::entry::Delta; 10]>>::triple Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::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_hash::object_id::ObjectId; 1]>>::triple <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple Line | Count | Source | 995 | 1.38k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 1.38k | if self.spilled() { | 998 | 1.02k | let (ptr, len) = self.data.heap(); | 999 | 1.02k | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 363 | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 1.38k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple <smallvec::SmallVec<[u8; 23]>>::triple Line | Count | Source | 995 | 70.4k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 70.4k | if self.spilled() { | 998 | 3.29k | let (ptr, len) = self.data.heap(); | 999 | 3.29k | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 67.1k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 70.4k | } |
<smallvec::SmallVec<[u8; 23]>>::triple Line | Count | Source | 995 | 671k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 671k | if self.spilled() { | 998 | 15.3k | let (ptr, len) = self.data.heap(); | 999 | 15.3k | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 656k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 671k | } |
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::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 <smallvec::SmallVec<[u8; 256]>>::triple Line | Count | Source | 995 | 1.88k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 1.88k | if self.spilled() { | 998 | 876 | let (ptr, len) = self.data.heap(); | 999 | 876 | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 1.00k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 1.88k | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::triple Line | Count | Source | 995 | 7.11k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 7.11k | if self.spilled() { | 998 | 2.16k | let (ptr, len) = self.data.heap(); | 999 | 2.16k | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 4.94k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 7.11k | } |
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<[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 | 995 | 71.7k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 71.7k | if self.spilled() { | 998 | 9.85k | let (ptr, len) = self.data.heap(); | 999 | 9.85k | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 61.8k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 71.7k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple Line | Count | Source | 995 | 18.1k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 18.1k | if self.spilled() { | 998 | 0 | let (ptr, len) = self.data.heap(); | 999 | 0 | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 18.1k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 18.1k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple Line | Count | Source | 995 | 2.20k | fn triple(&self) -> (ConstNonNull<A::Item>, usize, usize) { | 996 | | unsafe { | 997 | 2.20k | if self.spilled() { | 998 | 1.01k | let (ptr, len) = self.data.heap(); | 999 | 1.01k | (ptr, len, self.capacity) | 1000 | | } else { | 1001 | 1.19k | (self.data.inline(), self.capacity, Self::inline_capacity()) | 1002 | | } | 1003 | | } | 1004 | 2.20k | } |
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_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 |
1005 | | |
1006 | | /// Returns a tuple with (data ptr, len ptr, capacity) |
1007 | | #[inline] |
1008 | 1.81M | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { |
1009 | | unsafe { |
1010 | 1.81M | if self.spilled() { |
1011 | 767k | let (ptr, len_ptr) = self.data.heap_mut(); |
1012 | 767k | (ptr, len_ptr, self.capacity) |
1013 | | } else { |
1014 | 1.05M | ( |
1015 | 1.05M | self.data.inline_mut(), |
1016 | 1.05M | &mut self.capacity, |
1017 | 1.05M | Self::inline_capacity(), |
1018 | 1.05M | ) |
1019 | | } |
1020 | | } |
1021 | 1.81M | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple_mut Line | Count | Source | 1008 | 36.8k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 36.8k | if self.spilled() { | 1011 | 361 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 361 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 36.4k | ( | 1015 | 36.4k | self.data.inline_mut(), | 1016 | 36.4k | &mut self.capacity, | 1017 | 36.4k | Self::inline_capacity(), | 1018 | 36.4k | ) | 1019 | | } | 1020 | | } | 1021 | 36.8k | } |
<smallvec::SmallVec<[u8; 2]>>::triple_mut Line | Count | Source | 1008 | 42.0k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 42.0k | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 42.0k | ( | 1015 | 42.0k | self.data.inline_mut(), | 1016 | 42.0k | &mut self.capacity, | 1017 | 42.0k | Self::inline_capacity(), | 1018 | 42.0k | ) | 1019 | | } | 1020 | | } | 1021 | 42.0k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple_mut Line | Count | Source | 1008 | 77.2k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 77.2k | if self.spilled() { | 1011 | 2.66k | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 2.66k | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 74.5k | ( | 1015 | 74.5k | self.data.inline_mut(), | 1016 | 74.5k | &mut self.capacity, | 1017 | 74.5k | Self::inline_capacity(), | 1018 | 74.5k | ) | 1019 | | } | 1020 | | } | 1021 | 77.2k | } |
<smallvec::SmallVec<[u8; 2]>>::triple_mut Line | Count | Source | 1008 | 102k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 102k | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 102k | ( | 1015 | 102k | self.data.inline_mut(), | 1016 | 102k | &mut self.capacity, | 1017 | 102k | Self::inline_capacity(), | 1018 | 102k | ) | 1019 | | } | 1020 | | } | 1021 | 102k | } |
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; 28]>>::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 Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::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<[gix_hash::object_id::ObjectId; 1]>>::triple_mut Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple_mut <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::triple_mut Line | Count | Source | 1008 | 6.35k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 6.35k | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 6.35k | ( | 1015 | 6.35k | self.data.inline_mut(), | 1016 | 6.35k | &mut self.capacity, | 1017 | 6.35k | Self::inline_capacity(), | 1018 | 6.35k | ) | 1019 | | } | 1020 | | } | 1021 | 6.35k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::triple_mut <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut Line | Count | Source | 1008 | 9.97k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 9.97k | if self.spilled() { | 1011 | 7.78k | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 7.78k | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 2.18k | ( | 1015 | 2.18k | self.data.inline_mut(), | 1016 | 2.18k | &mut self.capacity, | 1017 | 2.18k | Self::inline_capacity(), | 1018 | 2.18k | ) | 1019 | | } | 1020 | | } | 1021 | 9.97k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple_mut <smallvec::SmallVec<[u8; 23]>>::triple_mut Line | Count | Source | 1008 | 124k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 124k | if self.spilled() { | 1011 | 1.32k | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 1.32k | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 123k | ( | 1015 | 123k | self.data.inline_mut(), | 1016 | 123k | &mut self.capacity, | 1017 | 123k | Self::inline_capacity(), | 1018 | 123k | ) | 1019 | | } | 1020 | | } | 1021 | 124k | } |
<smallvec::SmallVec<[u8; 23]>>::triple_mut Line | Count | Source | 1008 | 491k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 491k | if self.spilled() { | 1011 | 4.48k | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 4.48k | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 487k | ( | 1015 | 487k | self.data.inline_mut(), | 1016 | 487k | &mut self.capacity, | 1017 | 487k | Self::inline_capacity(), | 1018 | 487k | ) | 1019 | | } | 1020 | | } | 1021 | 491k | } |
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<[gix_hash::object_id::ObjectId; 1]>>::triple_mut Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::triple_mut <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::triple_mut Line | Count | Source | 1008 | 270 | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 270 | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 270 | ( | 1015 | 270 | self.data.inline_mut(), | 1016 | 270 | &mut self.capacity, | 1017 | 270 | Self::inline_capacity(), | 1018 | 270 | ) | 1019 | | } | 1020 | | } | 1021 | 270 | } |
<smallvec::SmallVec<[u8; 256]>>::triple_mut Line | Count | Source | 1008 | 2.82k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 2.82k | if self.spilled() { | 1011 | 876 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 876 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 1.94k | ( | 1015 | 1.94k | self.data.inline_mut(), | 1016 | 1.94k | &mut self.capacity, | 1017 | 1.94k | Self::inline_capacity(), | 1018 | 1.94k | ) | 1019 | | } | 1020 | | } | 1021 | 2.82k | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::triple_mut Line | Count | Source | 1008 | 728k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 728k | if self.spilled() { | 1011 | 714k | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 714k | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 14.0k | ( | 1015 | 14.0k | self.data.inline_mut(), | 1016 | 14.0k | &mut self.capacity, | 1017 | 14.0k | Self::inline_capacity(), | 1018 | 14.0k | ) | 1019 | | } | 1020 | | } | 1021 | 728k | } |
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 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; 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 | 1008 | 46.3k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 46.3k | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 46.3k | ( | 1015 | 46.3k | self.data.inline_mut(), | 1016 | 46.3k | &mut self.capacity, | 1017 | 46.3k | Self::inline_capacity(), | 1018 | 46.3k | ) | 1019 | | } | 1020 | | } | 1021 | 46.3k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut Line | Count | Source | 1008 | 6.92k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 6.92k | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 6.92k | ( | 1015 | 6.92k | self.data.inline_mut(), | 1016 | 6.92k | &mut self.capacity, | 1017 | 6.92k | Self::inline_capacity(), | 1018 | 6.92k | ) | 1019 | | } | 1020 | | } | 1021 | 6.92k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut Line | Count | Source | 1008 | 6.52k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 6.52k | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 6.52k | ( | 1015 | 6.52k | self.data.inline_mut(), | 1016 | 6.52k | &mut self.capacity, | 1017 | 6.52k | Self::inline_capacity(), | 1018 | 6.52k | ) | 1019 | | } | 1020 | | } | 1021 | 6.52k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::triple_mut Line | Count | Source | 1008 | 97.7k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 97.7k | if self.spilled() { | 1011 | 17.6k | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 17.6k | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 80.0k | ( | 1015 | 80.0k | self.data.inline_mut(), | 1016 | 80.0k | &mut self.capacity, | 1017 | 80.0k | Self::inline_capacity(), | 1018 | 80.0k | ) | 1019 | | } | 1020 | | } | 1021 | 97.7k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::triple_mut Line | Count | Source | 1008 | 4.55k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 4.55k | if self.spilled() { | 1011 | 0 | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 0 | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 4.55k | ( | 1015 | 4.55k | self.data.inline_mut(), | 1016 | 4.55k | &mut self.capacity, | 1017 | 4.55k | Self::inline_capacity(), | 1018 | 4.55k | ) | 1019 | | } | 1020 | | } | 1021 | 4.55k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::triple_mut Line | Count | Source | 1008 | 34.4k | fn triple_mut(&mut self) -> (NonNull<A::Item>, &mut usize, usize) { | 1009 | | unsafe { | 1010 | 34.4k | if self.spilled() { | 1011 | 17.5k | let (ptr, len_ptr) = self.data.heap_mut(); | 1012 | 17.5k | (ptr, len_ptr, self.capacity) | 1013 | | } else { | 1014 | 16.8k | ( | 1015 | 16.8k | self.data.inline_mut(), | 1016 | 16.8k | &mut self.capacity, | 1017 | 16.8k | Self::inline_capacity(), | 1018 | 16.8k | ) | 1019 | | } | 1020 | | } | 1021 | 34.4k | } |
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_hash::object_id::ObjectId; 1]>>::triple_mut Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::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 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 |
1022 | | |
1023 | | /// Returns `true` if the data has spilled into a separate heap-allocated buffer. |
1024 | | #[inline] |
1025 | 12.3M | pub fn spilled(&self) -> bool { |
1026 | 12.3M | self.capacity > Self::inline_capacity() |
1027 | 12.3M | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::spilled Line | Count | Source | 1025 | 68.5k | pub fn spilled(&self) -> bool { | 1026 | 68.5k | self.capacity > Self::inline_capacity() | 1027 | 68.5k | } |
<smallvec::SmallVec<[u8; 2]>>::spilled Line | Count | Source | 1025 | 84.1k | pub fn spilled(&self) -> bool { | 1026 | 84.1k | self.capacity > Self::inline_capacity() | 1027 | 84.1k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::spilled Line | Count | Source | 1025 | 9.33M | pub fn spilled(&self) -> bool { | 1026 | 9.33M | self.capacity > Self::inline_capacity() | 1027 | 9.33M | } |
<smallvec::SmallVec<[u8; 2]>>::spilled Line | Count | Source | 1025 | 176k | pub fn spilled(&self) -> bool { | 1026 | 176k | self.capacity > Self::inline_capacity() | 1027 | 176k | } |
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; 28]>>::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 Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::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<[gix_hash::object_id::ObjectId; 1]>>::spilled Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::spilled <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::spilled Line | Count | Source | 1025 | 12.9k | pub fn spilled(&self) -> bool { | 1026 | 12.9k | self.capacity > Self::inline_capacity() | 1027 | 12.9k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::spilled <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled Line | Count | Source | 1025 | 13.7k | pub fn spilled(&self) -> bool { | 1026 | 13.7k | self.capacity > Self::inline_capacity() | 1027 | 13.7k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::spilled <smallvec::SmallVec<[u8; 23]>>::spilled Line | Count | Source | 1025 | 272k | pub fn spilled(&self) -> bool { | 1026 | 272k | self.capacity > Self::inline_capacity() | 1027 | 272k | } |
<smallvec::SmallVec<[u8; 23]>>::spilled Line | Count | Source | 1025 | 1.29M | pub fn spilled(&self) -> bool { | 1026 | 1.29M | self.capacity > Self::inline_capacity() | 1027 | 1.29M | } |
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<[gix_hash::object_id::ObjectId; 1]>>::spilled Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::spilled <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::spilled Line | Count | Source | 1025 | 547 | pub fn spilled(&self) -> bool { | 1026 | 547 | self.capacity > Self::inline_capacity() | 1027 | 547 | } |
<smallvec::SmallVec<[u8; 256]>>::spilled Line | Count | Source | 1025 | 5.38k | pub fn spilled(&self) -> bool { | 1026 | 5.38k | self.capacity > Self::inline_capacity() | 1027 | 5.38k | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::spilled Line | Count | Source | 1025 | 740k | pub fn spilled(&self) -> bool { | 1026 | 740k | self.capacity > Self::inline_capacity() | 1027 | 740k | } |
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 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; 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 | 1025 | 94.6k | pub fn spilled(&self) -> bool { | 1026 | 94.6k | self.capacity > Self::inline_capacity() | 1027 | 94.6k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled Line | Count | Source | 1025 | 13.8k | pub fn spilled(&self) -> bool { | 1026 | 13.8k | self.capacity > Self::inline_capacity() | 1027 | 13.8k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled Line | Count | Source | 1025 | 13.4k | pub fn spilled(&self) -> bool { | 1026 | 13.4k | self.capacity > Self::inline_capacity() | 1027 | 13.4k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::spilled Line | Count | Source | 1025 | 175k | pub fn spilled(&self) -> bool { | 1026 | 175k | self.capacity > Self::inline_capacity() | 1027 | 175k | } |
<smallvec::SmallVec<[(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>); 3]>>::spilled Line | Count | Source | 1025 | 22.6k | pub fn spilled(&self) -> bool { | 1026 | 22.6k | self.capacity > Self::inline_capacity() | 1027 | 22.6k | } |
<smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::spilled Line | Count | Source | 1025 | 37.3k | pub fn spilled(&self) -> bool { | 1026 | 37.3k | self.capacity > Self::inline_capacity() | 1027 | 37.3k | } |
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_hash::object_id::ObjectId; 1]>>::spilled Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::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 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 |
1028 | | |
1029 | | /// Creates a draining iterator that removes the specified range in the vector |
1030 | | /// and yields the removed items. |
1031 | | /// |
1032 | | /// Note 1: The element range is removed even if the iterator is only |
1033 | | /// partially consumed or not consumed at all. |
1034 | | /// |
1035 | | /// Note 2: It is unspecified how many elements are removed from the vector |
1036 | | /// if the `Drain` value is leaked. |
1037 | | /// |
1038 | | /// # Panics |
1039 | | /// |
1040 | | /// Panics if the starting point is greater than the end point or if |
1041 | | /// the end point is greater than the length of the vector. |
1042 | | pub fn drain<R>(&mut self, range: R) -> Drain<'_, A> |
1043 | | where |
1044 | | R: RangeBounds<usize>, |
1045 | | { |
1046 | | use core::ops::Bound::*; |
1047 | | |
1048 | | let len = self.len(); |
1049 | | let start = match range.start_bound() { |
1050 | | Included(&n) => n, |
1051 | | Excluded(&n) => n.checked_add(1).expect("Range start out of bounds"), |
1052 | | Unbounded => 0, |
1053 | | }; |
1054 | | let end = match range.end_bound() { |
1055 | | Included(&n) => n.checked_add(1).expect("Range end out of bounds"), |
1056 | | Excluded(&n) => n, |
1057 | | Unbounded => len, |
1058 | | }; |
1059 | | |
1060 | | assert!(start <= end); |
1061 | | assert!(end <= len); |
1062 | | |
1063 | | unsafe { |
1064 | | self.set_len(start); |
1065 | | |
1066 | | let range_slice = slice::from_raw_parts(self.as_ptr().add(start), end - start); |
1067 | | |
1068 | | Drain { |
1069 | | tail_start: end, |
1070 | | tail_len: len - end, |
1071 | | iter: range_slice.iter(), |
1072 | | // Since self is a &mut, passing it to a function would invalidate the slice iterator. |
1073 | | vec: NonNull::new_unchecked(self as *mut _), |
1074 | | } |
1075 | | } |
1076 | | } |
1077 | | |
1078 | | #[cfg(feature = "drain_filter")] |
1079 | | /// Creates an iterator which uses a closure to determine if an element should be removed. |
1080 | | /// |
1081 | | /// If the closure returns true, the element is removed and yielded. If the closure returns |
1082 | | /// false, the element will remain in the vector and will not be yielded by the iterator. |
1083 | | /// |
1084 | | /// Using this method is equivalent to the following code: |
1085 | | /// ``` |
1086 | | /// # use smallvec::SmallVec; |
1087 | | /// # let some_predicate = |x: &mut i32| { *x == 2 || *x == 3 || *x == 6 }; |
1088 | | /// # let mut vec: SmallVec<[i32; 8]> = SmallVec::from_slice(&[1i32, 2, 3, 4, 5, 6]); |
1089 | | /// let mut i = 0; |
1090 | | /// while i < vec.len() { |
1091 | | /// if some_predicate(&mut vec[i]) { |
1092 | | /// let val = vec.remove(i); |
1093 | | /// // your code here |
1094 | | /// } else { |
1095 | | /// i += 1; |
1096 | | /// } |
1097 | | /// } |
1098 | | /// |
1099 | | /// # assert_eq!(vec, SmallVec::<[i32; 8]>::from_slice(&[1i32, 4, 5])); |
1100 | | /// ``` |
1101 | | /// /// |
1102 | | /// But `drain_filter` is easier to use. `drain_filter` is also more efficient, |
1103 | | /// because it can backshift the elements of the array in bulk. |
1104 | | /// |
1105 | | /// Note that `drain_filter` also lets you mutate every element in the filter closure, |
1106 | | /// regardless of whether you choose to keep or remove it. |
1107 | | /// |
1108 | | /// # Examples |
1109 | | /// |
1110 | | /// Splitting an array into evens and odds, reusing the original allocation: |
1111 | | /// |
1112 | | /// ``` |
1113 | | /// # use smallvec::SmallVec; |
1114 | | /// let mut numbers: SmallVec<[i32; 16]> = SmallVec::from_slice(&[1i32, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15]); |
1115 | | /// |
1116 | | /// let evens = numbers.drain_filter(|x| *x % 2 == 0).collect::<SmallVec<[i32; 16]>>(); |
1117 | | /// let odds = numbers; |
1118 | | /// |
1119 | | /// assert_eq!(evens, SmallVec::<[i32; 16]>::from_slice(&[2i32, 4, 6, 8, 14])); |
1120 | | /// assert_eq!(odds, SmallVec::<[i32; 16]>::from_slice(&[1i32, 3, 5, 9, 11, 13, 15])); |
1121 | | /// ``` |
1122 | | pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, A, F,> |
1123 | | where |
1124 | | F: FnMut(&mut A::Item) -> bool, |
1125 | | { |
1126 | | let old_len = self.len(); |
1127 | | |
1128 | | // Guard against us getting leaked (leak amplification) |
1129 | | unsafe { |
1130 | | self.set_len(0); |
1131 | | } |
1132 | | |
1133 | | DrainFilter { vec: self, idx: 0, del: 0, old_len, pred: filter, panic_flag: false } |
1134 | | } |
1135 | | |
1136 | | /// Append an item to the vector. |
1137 | | #[inline] |
1138 | 751k | pub fn push(&mut self, value: A::Item) { |
1139 | | unsafe { |
1140 | 751k | let (mut ptr, mut len, cap) = self.triple_mut(); |
1141 | 751k | if *len == cap { |
1142 | 5.44k | self.reserve_one_unchecked(); |
1143 | 5.44k | let (heap_ptr, heap_len) = self.data.heap_mut(); |
1144 | 5.44k | ptr = heap_ptr; |
1145 | 5.44k | len = heap_len; |
1146 | 745k | } |
1147 | 751k | ptr::write(ptr.as_ptr().add(*len), value); |
1148 | 751k | *len += 1; |
1149 | | } |
1150 | 751k | } Unexecuted instantiation: <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::push <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::push Line | Count | Source | 1138 | 424 | pub fn push(&mut self, value: A::Item) { | 1139 | | unsafe { | 1140 | 424 | let (mut ptr, mut len, cap) = self.triple_mut(); | 1141 | 424 | if *len == cap { | 1142 | 27 | self.reserve_one_unchecked(); | 1143 | 27 | let (heap_ptr, heap_len) = self.data.heap_mut(); | 1144 | 27 | ptr = heap_ptr; | 1145 | 27 | len = heap_len; | 1146 | 397 | } | 1147 | 424 | ptr::write(ptr.as_ptr().add(*len), value); | 1148 | 424 | *len += 1; | 1149 | | } | 1150 | 424 | } |
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_pack::data::file::decode::entry::Delta; 10]>>::push Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 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<[gix_hash::object_id::ObjectId; 1]>>::push <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::push Line | Count | Source | 1138 | 7.70k | pub fn push(&mut self, value: A::Item) { | 1139 | | unsafe { | 1140 | 7.70k | let (mut ptr, mut len, cap) = self.triple_mut(); | 1141 | 7.70k | if *len == cap { | 1142 | 462 | self.reserve_one_unchecked(); | 1143 | 462 | let (heap_ptr, heap_len) = self.data.heap_mut(); | 1144 | 462 | ptr = heap_ptr; | 1145 | 462 | len = heap_len; | 1146 | 7.24k | } | 1147 | 7.70k | ptr::write(ptr.as_ptr().add(*len), value); | 1148 | 7.70k | *len += 1; | 1149 | | } | 1150 | 7.70k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::push Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::push Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::push Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::push Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::push <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::push Line | Count | Source | 1138 | 721k | pub fn push(&mut self, value: A::Item) { | 1139 | | unsafe { | 1140 | 721k | let (mut ptr, mut len, cap) = self.triple_mut(); | 1141 | 721k | if *len == cap { | 1142 | 856 | self.reserve_one_unchecked(); | 1143 | 856 | let (heap_ptr, heap_len) = self.data.heap_mut(); | 1144 | 856 | ptr = heap_ptr; | 1145 | 856 | len = heap_len; | 1146 | 720k | } | 1147 | 721k | ptr::write(ptr.as_ptr().add(*len), value); | 1148 | 721k | *len += 1; | 1149 | | } | 1150 | 721k | } |
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<[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 | 1138 | 14.4k | pub fn push(&mut self, value: A::Item) { | 1139 | | unsafe { | 1140 | 14.4k | let (mut ptr, mut len, cap) = self.triple_mut(); | 1141 | 14.4k | if *len == cap { | 1142 | 3.36k | self.reserve_one_unchecked(); | 1143 | 3.36k | let (heap_ptr, heap_len) = self.data.heap_mut(); | 1144 | 3.36k | ptr = heap_ptr; | 1145 | 3.36k | len = heap_len; | 1146 | 11.0k | } | 1147 | 14.4k | ptr::write(ptr.as_ptr().add(*len), value); | 1148 | 14.4k | *len += 1; | 1149 | | } | 1150 | 14.4k | } |
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 | 1138 | 6.83k | pub fn push(&mut self, value: A::Item) { | 1139 | | unsafe { | 1140 | 6.83k | let (mut ptr, mut len, cap) = self.triple_mut(); | 1141 | 6.83k | if *len == cap { | 1142 | 735 | self.reserve_one_unchecked(); | 1143 | 735 | let (heap_ptr, heap_len) = self.data.heap_mut(); | 1144 | 735 | ptr = heap_ptr; | 1145 | 735 | len = heap_len; | 1146 | 6.09k | } | 1147 | 6.83k | ptr::write(ptr.as_ptr().add(*len), value); | 1148 | 6.83k | *len += 1; | 1149 | | } | 1150 | 6.83k | } |
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_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 |
1151 | | |
1152 | | /// Remove an item from the end of the vector and return it, or None if empty. |
1153 | | #[inline] |
1154 | 14.9k | pub fn pop(&mut self) -> Option<A::Item> { |
1155 | | unsafe { |
1156 | 14.9k | let (ptr, len_ptr, _) = self.triple_mut(); |
1157 | 14.9k | let ptr: *const _ = ptr.as_ptr(); |
1158 | 14.9k | if *len_ptr == 0 { |
1159 | 1.29k | return None; |
1160 | 13.6k | } |
1161 | 13.6k | let last_index = *len_ptr - 1; |
1162 | 13.6k | *len_ptr = last_index; |
1163 | 13.6k | Some(ptr::read(ptr.add(last_index))) |
1164 | | } |
1165 | 14.9k | } 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 | 1154 | 14.9k | pub fn pop(&mut self) -> Option<A::Item> { | 1155 | | unsafe { | 1156 | 14.9k | let (ptr, len_ptr, _) = self.triple_mut(); | 1157 | 14.9k | let ptr: *const _ = ptr.as_ptr(); | 1158 | 14.9k | if *len_ptr == 0 { | 1159 | 1.29k | return None; | 1160 | 13.6k | } | 1161 | 13.6k | let last_index = *len_ptr - 1; | 1162 | 13.6k | *len_ptr = last_index; | 1163 | 13.6k | Some(ptr::read(ptr.add(last_index))) | 1164 | | } | 1165 | 14.9k | } |
Unexecuted instantiation: <smallvec::SmallVec<[(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>); 8]>>::pop |
1166 | | |
1167 | | /// Moves all the elements of `other` into `self`, leaving `other` empty. |
1168 | | /// |
1169 | | /// # Example |
1170 | | /// |
1171 | | /// ``` |
1172 | | /// # use smallvec::{SmallVec, smallvec}; |
1173 | | /// let mut v0: SmallVec<[u8; 16]> = smallvec![1, 2, 3]; |
1174 | | /// let mut v1: SmallVec<[u8; 32]> = smallvec![4, 5, 6]; |
1175 | | /// v0.append(&mut v1); |
1176 | | /// assert_eq!(*v0, [1, 2, 3, 4, 5, 6]); |
1177 | | /// assert_eq!(*v1, []); |
1178 | | /// ``` |
1179 | | pub fn append<B>(&mut self, other: &mut SmallVec<B>) |
1180 | | where |
1181 | | B: Array<Item = A::Item>, |
1182 | | { |
1183 | | self.extend(other.drain(..)) |
1184 | | } |
1185 | | |
1186 | | /// Re-allocate to set the capacity to `max(new_cap, inline_size())`. |
1187 | | /// |
1188 | | /// Panics if `new_cap` is less than the vector's length |
1189 | | /// or if the capacity computation overflows `usize`. |
1190 | | pub fn grow(&mut self, new_cap: usize) { |
1191 | | infallible(self.try_grow(new_cap)) |
1192 | | } |
1193 | | |
1194 | | /// Re-allocate to set the capacity to `max(new_cap, inline_size())`. |
1195 | | /// |
1196 | | /// Panics if `new_cap` is less than the vector's length |
1197 | 14.0k | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { |
1198 | | unsafe { |
1199 | 14.0k | let unspilled = !self.spilled(); |
1200 | 14.0k | let (ptr, &mut len, cap) = self.triple_mut(); |
1201 | 14.0k | assert!(new_cap >= len); |
1202 | 14.0k | if new_cap <= Self::inline_capacity() { |
1203 | 0 | if unspilled { |
1204 | 0 | return Ok(()); |
1205 | 0 | } |
1206 | 0 | self.data = SmallVecData::empty(); |
1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); |
1208 | 0 | self.capacity = len; |
1209 | 0 | deallocate(ptr, cap); |
1210 | 14.0k | } else if new_cap != cap { |
1211 | 14.0k | let layout = layout_array::<A::Item>(new_cap)?; |
1212 | 14.0k | debug_assert!(layout.size() > 0); |
1213 | | let new_alloc; |
1214 | 14.0k | if unspilled { |
1215 | 10.4k | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) |
1216 | 10.4k | .ok_or(CollectionAllocErr::AllocErr { layout })? |
1217 | 10.4k | .cast(); |
1218 | 10.4k | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); |
1219 | | } else { |
1220 | | // This should never fail since the same succeeded |
1221 | | // when previously allocating `ptr`. |
1222 | 3.67k | let old_layout = layout_array::<A::Item>(cap)?; |
1223 | | |
1224 | 3.67k | let new_ptr = |
1225 | 3.67k | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); |
1226 | 3.67k | new_alloc = NonNull::new(new_ptr) |
1227 | 3.67k | .ok_or(CollectionAllocErr::AllocErr { layout })? |
1228 | 3.67k | .cast(); |
1229 | | } |
1230 | 14.0k | self.data = SmallVecData::from_heap(new_alloc, len); |
1231 | 14.0k | self.capacity = new_cap; |
1232 | 0 | } |
1233 | 14.0k | Ok(()) |
1234 | | } |
1235 | 14.0k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_grow Line | Count | Source | 1197 | 361 | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 361 | let unspilled = !self.spilled(); | 1200 | 361 | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 361 | assert!(new_cap >= len); | 1202 | 361 | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 361 | } else if new_cap != cap { | 1211 | 361 | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 361 | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 361 | if unspilled { | 1215 | 361 | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 361 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 361 | .cast(); | 1218 | 361 | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 0 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 0 | let new_ptr = | 1225 | 0 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 0 | new_alloc = NonNull::new(new_ptr) | 1227 | 0 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 0 | .cast(); | 1229 | | } | 1230 | 361 | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 361 | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 361 | Ok(()) | 1234 | | } | 1235 | 361 | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_grow Line | Count | Source | 1197 | 1.64k | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 1.64k | let unspilled = !self.spilled(); | 1200 | 1.64k | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 1.64k | assert!(new_cap >= len); | 1202 | 1.64k | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 1.64k | } else if new_cap != cap { | 1211 | 1.64k | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 1.64k | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 1.64k | if unspilled { | 1215 | 1.35k | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 1.35k | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 1.35k | .cast(); | 1218 | 1.35k | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 290 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 290 | let new_ptr = | 1225 | 290 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 290 | new_alloc = NonNull::new(new_ptr) | 1227 | 290 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 290 | .cast(); | 1229 | | } | 1230 | 1.64k | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 1.64k | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 1.64k | Ok(()) | 1234 | | } | 1235 | 1.64k | } |
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<[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_pack::data::file::decode::entry::Delta; 10]>>::try_grow Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 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<[gix_hash::object_id::ObjectId; 1]>>::try_grow <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::try_grow Line | Count | Source | 1197 | 462 | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 462 | let unspilled = !self.spilled(); | 1200 | 462 | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 462 | assert!(new_cap >= len); | 1202 | 462 | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 462 | } else if new_cap != cap { | 1211 | 462 | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 462 | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 462 | if unspilled { | 1215 | 121 | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 121 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 121 | .cast(); | 1218 | 121 | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 341 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 341 | let new_ptr = | 1225 | 341 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 341 | new_alloc = NonNull::new(new_ptr) | 1227 | 341 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 341 | .cast(); | 1229 | | } | 1230 | 462 | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 462 | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 462 | Ok(()) | 1234 | | } | 1235 | 462 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::try_grow <smallvec::SmallVec<[u8; 23]>>::try_grow Line | Count | Source | 1197 | 1.32k | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 1.32k | let unspilled = !self.spilled(); | 1200 | 1.32k | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 1.32k | assert!(new_cap >= len); | 1202 | 1.32k | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 1.32k | } else if new_cap != cap { | 1211 | 1.32k | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 1.32k | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 1.32k | if unspilled { | 1215 | 1.32k | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 1.32k | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 1.32k | .cast(); | 1218 | 1.32k | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 0 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 0 | let new_ptr = | 1225 | 0 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 0 | new_alloc = NonNull::new(new_ptr) | 1227 | 0 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 0 | .cast(); | 1229 | | } | 1230 | 1.32k | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 1.32k | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 1.32k | Ok(()) | 1234 | | } | 1235 | 1.32k | } |
<smallvec::SmallVec<[u8; 23]>>::try_grow Line | Count | Source | 1197 | 4.48k | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 4.48k | let unspilled = !self.spilled(); | 1200 | 4.48k | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 4.48k | assert!(new_cap >= len); | 1202 | 4.48k | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 4.48k | } else if new_cap != cap { | 1211 | 4.48k | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 4.48k | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 4.48k | if unspilled { | 1215 | 4.48k | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 4.48k | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 4.48k | .cast(); | 1218 | 4.48k | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 0 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 0 | let new_ptr = | 1225 | 0 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 0 | new_alloc = NonNull::new(new_ptr) | 1227 | 0 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 0 | .cast(); | 1229 | | } | 1230 | 4.48k | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 4.48k | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 4.48k | Ok(()) | 1234 | | } | 1235 | 4.48k | } |
Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 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 <smallvec::SmallVec<[u8; 256]>>::try_grow Line | Count | Source | 1197 | 219 | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 219 | let unspilled = !self.spilled(); | 1200 | 219 | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 219 | assert!(new_cap >= len); | 1202 | 219 | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 219 | } else if new_cap != cap { | 1211 | 219 | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 219 | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 219 | if unspilled { | 1215 | 219 | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 219 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 219 | .cast(); | 1218 | 219 | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 0 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 0 | let new_ptr = | 1225 | 0 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 0 | new_alloc = NonNull::new(new_ptr) | 1227 | 0 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 0 | .cast(); | 1229 | | } | 1230 | 219 | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 219 | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 219 | Ok(()) | 1234 | | } | 1235 | 219 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::try_grow Line | Count | Source | 1197 | 856 | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 856 | let unspilled = !self.spilled(); | 1200 | 856 | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 856 | assert!(new_cap >= len); | 1202 | 856 | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 856 | } else if new_cap != cap { | 1211 | 856 | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 856 | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 856 | if unspilled { | 1215 | 179 | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 179 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 179 | .cast(); | 1218 | 179 | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 677 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 677 | let new_ptr = | 1225 | 677 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 677 | new_alloc = NonNull::new(new_ptr) | 1227 | 677 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 677 | .cast(); | 1229 | | } | 1230 | 856 | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 856 | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 856 | Ok(()) | 1234 | | } | 1235 | 856 | } |
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<[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 | 1197 | 4.00k | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 4.00k | let unspilled = !self.spilled(); | 1200 | 4.00k | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 4.00k | assert!(new_cap >= len); | 1202 | 4.00k | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 4.00k | } else if new_cap != cap { | 1211 | 4.00k | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 4.00k | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 4.00k | if unspilled { | 1215 | 1.97k | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 1.97k | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 1.97k | .cast(); | 1218 | 1.97k | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 2.03k | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 2.03k | let new_ptr = | 1225 | 2.03k | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 2.03k | new_alloc = NonNull::new(new_ptr) | 1227 | 2.03k | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 2.03k | .cast(); | 1229 | | } | 1230 | 4.00k | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 4.00k | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 4.00k | Ok(()) | 1234 | | } | 1235 | 4.00k | } |
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 | 1197 | 735 | pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { | 1198 | | unsafe { | 1199 | 735 | let unspilled = !self.spilled(); | 1200 | 735 | let (ptr, &mut len, cap) = self.triple_mut(); | 1201 | 735 | assert!(new_cap >= len); | 1202 | 735 | if new_cap <= Self::inline_capacity() { | 1203 | 0 | if unspilled { | 1204 | 0 | return Ok(()); | 1205 | 0 | } | 1206 | 0 | self.data = SmallVecData::empty(); | 1207 | 0 | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); | 1208 | 0 | self.capacity = len; | 1209 | 0 | deallocate(ptr, cap); | 1210 | 735 | } else if new_cap != cap { | 1211 | 735 | let layout = layout_array::<A::Item>(new_cap)?; | 1212 | 735 | debug_assert!(layout.size() > 0); | 1213 | | let new_alloc; | 1214 | 735 | if unspilled { | 1215 | 397 | new_alloc = NonNull::new(alloc::alloc::alloc(layout)) | 1216 | 397 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1217 | 397 | .cast(); | 1218 | 397 | ptr::copy_nonoverlapping(ptr.as_ptr(), new_alloc.as_ptr(), len); | 1219 | | } else { | 1220 | | // This should never fail since the same succeeded | 1221 | | // when previously allocating `ptr`. | 1222 | 338 | let old_layout = layout_array::<A::Item>(cap)?; | 1223 | | | 1224 | 338 | let new_ptr = | 1225 | 338 | alloc::alloc::realloc(ptr.as_ptr() as *mut u8, old_layout, layout.size()); | 1226 | 338 | new_alloc = NonNull::new(new_ptr) | 1227 | 338 | .ok_or(CollectionAllocErr::AllocErr { layout })? | 1228 | 338 | .cast(); | 1229 | | } | 1230 | 735 | self.data = SmallVecData::from_heap(new_alloc, len); | 1231 | 735 | self.capacity = new_cap; | 1232 | 0 | } | 1233 | 735 | Ok(()) | 1234 | | } | 1235 | 735 | } |
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_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 |
1236 | | |
1237 | | /// Reserve capacity for `additional` more elements to be inserted. |
1238 | | /// |
1239 | | /// May reserve more space to avoid frequent reallocations. |
1240 | | /// |
1241 | | /// Panics if the capacity computation overflows `usize`. |
1242 | | #[inline] |
1243 | 313k | pub fn reserve(&mut self, additional: usize) { |
1244 | 313k | infallible(self.try_reserve(additional)) |
1245 | 313k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::reserve Line | Count | Source | 1243 | 6.18k | pub fn reserve(&mut self, additional: usize) { | 1244 | 6.18k | infallible(self.try_reserve(additional)) | 1245 | 6.18k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::reserve Line | Count | Source | 1243 | 21.1k | pub fn reserve(&mut self, additional: usize) { | 1244 | 21.1k | infallible(self.try_reserve(additional)) | 1245 | 21.1k | } |
<smallvec::SmallVec<[u8; 2]>>::reserve Line | Count | Source | 1243 | 48.2k | pub fn reserve(&mut self, additional: usize) { | 1244 | 48.2k | infallible(self.try_reserve(additional)) | 1245 | 48.2k | } |
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_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_hash::object_id::ObjectId; 1]>>::reserve Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::reserve <smallvec::SmallVec<[u8; 23]>>::reserve Line | Count | Source | 1243 | 25.4k | pub fn reserve(&mut self, additional: usize) { | 1244 | 25.4k | infallible(self.try_reserve(additional)) | 1245 | 25.4k | } |
<smallvec::SmallVec<[u8; 23]>>::reserve Line | Count | Source | 1243 | 179k | pub fn reserve(&mut self, additional: usize) { | 1244 | 179k | infallible(self.try_reserve(additional)) | 1245 | 179k | } |
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 <smallvec::SmallVec<[u8; 256]>>::reserve Line | Count | Source | 1243 | 470 | pub fn reserve(&mut self, additional: usize) { | 1244 | 470 | infallible(self.try_reserve(additional)) | 1245 | 470 | } |
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 | 1243 | 30.0k | pub fn reserve(&mut self, additional: usize) { | 1244 | 30.0k | infallible(self.try_reserve(additional)) | 1245 | 30.0k | } |
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 | 1243 | 2.49k | pub fn reserve(&mut self, additional: usize) { | 1244 | 2.49k | infallible(self.try_reserve(additional)) | 1245 | 2.49k | } |
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_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 |
1246 | | |
1247 | | /// Internal method used to grow in push() and insert(), where we know already we have to grow. |
1248 | | #[cold] |
1249 | 5.44k | fn reserve_one_unchecked(&mut self) { |
1250 | 5.44k | debug_assert_eq!(self.len(), self.capacity()); |
1251 | 5.44k | let new_cap = self.len() |
1252 | 5.44k | .checked_add(1) |
1253 | 5.44k | .and_then(usize::checked_next_power_of_two) |
1254 | 5.44k | .expect("capacity overflow"); |
1255 | 5.44k | infallible(self.try_grow(new_cap)) |
1256 | 5.44k | } 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 | 1249 | 27 | fn reserve_one_unchecked(&mut self) { | 1250 | 27 | debug_assert_eq!(self.len(), self.capacity()); | 1251 | 27 | let new_cap = self.len() | 1252 | 27 | .checked_add(1) | 1253 | 27 | .and_then(usize::checked_next_power_of_two) | 1254 | 27 | .expect("capacity overflow"); | 1255 | 27 | infallible(self.try_grow(new_cap)) | 1256 | 27 | } |
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_pack::data::file::decode::entry::Delta; 10]>>::reserve_one_unchecked Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 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<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve_one_unchecked Line | Count | Source | 1249 | 462 | fn reserve_one_unchecked(&mut self) { | 1250 | 462 | debug_assert_eq!(self.len(), self.capacity()); | 1251 | 462 | let new_cap = self.len() | 1252 | 462 | .checked_add(1) | 1253 | 462 | .and_then(usize::checked_next_power_of_two) | 1254 | 462 | .expect("capacity overflow"); | 1255 | 462 | infallible(self.try_grow(new_cap)) | 1256 | 462 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::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<[gix_hash::object_id::ObjectId; 1]>>::reserve_one_unchecked Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::reserve_one_unchecked <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::reserve_one_unchecked Line | Count | Source | 1249 | 856 | fn reserve_one_unchecked(&mut self) { | 1250 | 856 | debug_assert_eq!(self.len(), self.capacity()); | 1251 | 856 | let new_cap = self.len() | 1252 | 856 | .checked_add(1) | 1253 | 856 | .and_then(usize::checked_next_power_of_two) | 1254 | 856 | .expect("capacity overflow"); | 1255 | 856 | infallible(self.try_grow(new_cap)) | 1256 | 856 | } |
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<[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 | 1249 | 3.36k | fn reserve_one_unchecked(&mut self) { | 1250 | 3.36k | debug_assert_eq!(self.len(), self.capacity()); | 1251 | 3.36k | let new_cap = self.len() | 1252 | 3.36k | .checked_add(1) | 1253 | 3.36k | .and_then(usize::checked_next_power_of_two) | 1254 | 3.36k | .expect("capacity overflow"); | 1255 | 3.36k | infallible(self.try_grow(new_cap)) | 1256 | 3.36k | } |
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 | 1249 | 735 | fn reserve_one_unchecked(&mut self) { | 1250 | 735 | debug_assert_eq!(self.len(), self.capacity()); | 1251 | 735 | let new_cap = self.len() | 1252 | 735 | .checked_add(1) | 1253 | 735 | .and_then(usize::checked_next_power_of_two) | 1254 | 735 | .expect("capacity overflow"); | 1255 | 735 | infallible(self.try_grow(new_cap)) | 1256 | 735 | } |
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_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 |
1257 | | |
1258 | | /// Reserve capacity for `additional` more elements to be inserted. |
1259 | | /// |
1260 | | /// May reserve more space to avoid frequent reallocations. |
1261 | 313k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { |
1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated |
1263 | | // calls to it from callers. |
1264 | 313k | let (_, &mut len, cap) = self.triple_mut(); |
1265 | 313k | if cap - len >= additional { |
1266 | 305k | return Ok(()); |
1267 | 8.42k | } |
1268 | 8.42k | let new_cap = len |
1269 | 8.42k | .checked_add(additional) |
1270 | 8.42k | .and_then(usize::checked_next_power_of_two) |
1271 | 8.42k | .ok_or(CollectionAllocErr::CapacityOverflow)?; |
1272 | 8.42k | self.try_grow(new_cap) |
1273 | 313k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_reserve Line | Count | Source | 1261 | 6.18k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 6.18k | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 6.18k | if cap - len >= additional { | 1266 | 5.82k | return Ok(()); | 1267 | 361 | } | 1268 | 361 | let new_cap = len | 1269 | 361 | .checked_add(additional) | 1270 | 361 | .and_then(usize::checked_next_power_of_two) | 1271 | 361 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 361 | self.try_grow(new_cap) | 1273 | 6.18k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]>>::try_reserve Line | Count | Source | 1261 | 21.1k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 21.1k | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 21.1k | if cap - len >= additional { | 1266 | 19.4k | return Ok(()); | 1267 | 1.61k | } | 1268 | 1.61k | let new_cap = len | 1269 | 1.61k | .checked_add(additional) | 1270 | 1.61k | .and_then(usize::checked_next_power_of_two) | 1271 | 1.61k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 1.61k | self.try_grow(new_cap) | 1273 | 21.1k | } |
<smallvec::SmallVec<[u8; 2]>>::try_reserve Line | Count | Source | 1261 | 48.2k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 48.2k | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 48.2k | if cap - len >= additional { | 1266 | 48.2k | return Ok(()); | 1267 | 0 | } | 1268 | 0 | let new_cap = len | 1269 | 0 | .checked_add(additional) | 1270 | 0 | .and_then(usize::checked_next_power_of_two) | 1271 | 0 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 0 | self.try_grow(new_cap) | 1273 | 48.2k | } |
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_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_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 <smallvec::SmallVec<[u8; 23]>>::try_reserve Line | Count | Source | 1261 | 25.4k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 25.4k | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 25.4k | if cap - len >= additional { | 1266 | 24.1k | return Ok(()); | 1267 | 1.32k | } | 1268 | 1.32k | let new_cap = len | 1269 | 1.32k | .checked_add(additional) | 1270 | 1.32k | .and_then(usize::checked_next_power_of_two) | 1271 | 1.32k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 1.32k | self.try_grow(new_cap) | 1273 | 25.4k | } |
<smallvec::SmallVec<[u8; 23]>>::try_reserve Line | Count | Source | 1261 | 179k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 179k | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 179k | if cap - len >= additional { | 1266 | 175k | return Ok(()); | 1267 | 4.48k | } | 1268 | 4.48k | let new_cap = len | 1269 | 4.48k | .checked_add(additional) | 1270 | 4.48k | .and_then(usize::checked_next_power_of_two) | 1271 | 4.48k | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 4.48k | self.try_grow(new_cap) | 1273 | 179k | } |
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 <smallvec::SmallVec<[u8; 256]>>::try_reserve Line | Count | Source | 1261 | 470 | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 470 | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 470 | if cap - len >= additional { | 1266 | 470 | return Ok(()); | 1267 | 0 | } | 1268 | 0 | let new_cap = len | 1269 | 0 | .checked_add(additional) | 1270 | 0 | .and_then(usize::checked_next_power_of_two) | 1271 | 0 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 0 | self.try_grow(new_cap) | 1273 | 470 | } |
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 | 1261 | 30.0k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 30.0k | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 30.0k | if cap - len >= additional { | 1266 | 29.3k | return Ok(()); | 1267 | 637 | } | 1268 | 637 | let new_cap = len | 1269 | 637 | .checked_add(additional) | 1270 | 637 | .and_then(usize::checked_next_power_of_two) | 1271 | 637 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 637 | self.try_grow(new_cap) | 1273 | 30.0k | } |
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 | 1261 | 2.49k | pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { | 1262 | | // prefer triple_mut() even if triple() would work so that the optimizer removes duplicated | 1263 | | // calls to it from callers. | 1264 | 2.49k | let (_, &mut len, cap) = self.triple_mut(); | 1265 | 2.49k | if cap - len >= additional { | 1266 | 2.49k | return Ok(()); | 1267 | 0 | } | 1268 | 0 | let new_cap = len | 1269 | 0 | .checked_add(additional) | 1270 | 0 | .and_then(usize::checked_next_power_of_two) | 1271 | 0 | .ok_or(CollectionAllocErr::CapacityOverflow)?; | 1272 | 0 | self.try_grow(new_cap) | 1273 | 2.49k | } |
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_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 |
1274 | | |
1275 | | /// Reserve the minimum capacity for `additional` more elements to be inserted. |
1276 | | /// |
1277 | | /// Panics if the new capacity overflows `usize`. |
1278 | 470 | pub fn reserve_exact(&mut self, additional: usize) { |
1279 | 470 | infallible(self.try_reserve_exact(additional)) |
1280 | 470 | } |
1281 | | |
1282 | | /// Reserve the minimum capacity for `additional` more elements to be inserted. |
1283 | 470 | pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { |
1284 | 470 | let (_, &mut len, cap) = self.triple_mut(); |
1285 | 470 | if cap - len >= additional { |
1286 | 251 | return Ok(()); |
1287 | 219 | } |
1288 | 219 | let new_cap = len |
1289 | 219 | .checked_add(additional) |
1290 | 219 | .ok_or(CollectionAllocErr::CapacityOverflow)?; |
1291 | 219 | self.try_grow(new_cap) |
1292 | 470 | } |
1293 | | |
1294 | | /// Shrink the capacity of the vector as much as possible. |
1295 | | /// |
1296 | | /// When possible, this will move data from an external heap buffer to the vector's inline |
1297 | | /// storage. |
1298 | | pub fn shrink_to_fit(&mut self) { |
1299 | | if !self.spilled() { |
1300 | | return; |
1301 | | } |
1302 | | let len = self.len(); |
1303 | | if self.inline_size() >= len { |
1304 | | unsafe { |
1305 | | let (ptr, len) = self.data.heap(); |
1306 | | self.data = SmallVecData::empty(); |
1307 | | ptr::copy_nonoverlapping(ptr.as_ptr(), self.data.inline_mut().as_ptr(), len); |
1308 | | deallocate(ptr.0, self.capacity); |
1309 | | self.capacity = len; |
1310 | | } |
1311 | | } else if self.capacity() > len { |
1312 | | self.grow(len); |
1313 | | } |
1314 | | } |
1315 | | |
1316 | | /// Shorten the vector, keeping the first `len` elements and dropping the rest. |
1317 | | /// |
1318 | | /// If `len` is greater than or equal to the vector's current length, this has no |
1319 | | /// effect. |
1320 | | /// |
1321 | | /// This does not re-allocate. If you want the vector's capacity to shrink, call |
1322 | | /// `shrink_to_fit` after truncating. |
1323 | 8.85k | pub fn truncate(&mut self, len: usize) { |
1324 | | unsafe { |
1325 | 8.85k | let (ptr, len_ptr, _) = self.triple_mut(); |
1326 | 8.85k | let ptr = ptr.as_ptr(); |
1327 | 9.43k | while len < *len_ptr { |
1328 | 577 | let last_index = *len_ptr - 1; |
1329 | 577 | *len_ptr = last_index; |
1330 | 577 | ptr::drop_in_place(ptr.add(last_index)); |
1331 | 577 | } |
1332 | | } |
1333 | 8.85k | } Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::truncate Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::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 | 1323 | 1.93k | pub fn truncate(&mut self, len: usize) { | 1324 | | unsafe { | 1325 | 1.93k | let (ptr, len_ptr, _) = self.triple_mut(); | 1326 | 1.93k | let ptr = ptr.as_ptr(); | 1327 | 2.51k | while len < *len_ptr { | 1328 | 577 | let last_index = *len_ptr - 1; | 1329 | 577 | *len_ptr = last_index; | 1330 | 577 | ptr::drop_in_place(ptr.add(last_index)); | 1331 | 577 | } | 1332 | | } | 1333 | 1.93k | } |
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 | 1323 | 6.92k | pub fn truncate(&mut self, len: usize) { | 1324 | | unsafe { | 1325 | 6.92k | let (ptr, len_ptr, _) = self.triple_mut(); | 1326 | 6.92k | let ptr = ptr.as_ptr(); | 1327 | 6.92k | while len < *len_ptr { | 1328 | 0 | let last_index = *len_ptr - 1; | 1329 | 0 | *len_ptr = last_index; | 1330 | 0 | ptr::drop_in_place(ptr.add(last_index)); | 1331 | 0 | } | 1332 | | } | 1333 | 6.92k | } |
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 |
1334 | | |
1335 | | /// Extracts a slice containing the entire vector. |
1336 | | /// |
1337 | | /// Equivalent to `&s[..]`. |
1338 | 69.7k | pub fn as_slice(&self) -> &[A::Item] { |
1339 | 69.7k | self |
1340 | 69.7k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::as_slice Line | Count | Source | 1338 | 6.18k | pub fn as_slice(&self) -> &[A::Item] { | 1339 | 6.18k | self | 1340 | 6.18k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 2]>>::as_slice Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice <smallvec::SmallVec<[u8; 23]>>::as_slice Line | Count | Source | 1338 | 50.8k | pub fn as_slice(&self) -> &[A::Item] { | 1339 | 50.8k | self | 1340 | 50.8k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]>>::as_slice Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::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 | 1338 | 12.6k | pub fn as_slice(&self) -> &[A::Item] { | 1339 | 12.6k | self | 1340 | 12.6k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]>>::as_slice Unexecuted instantiation: <smallvec::SmallVec<[&bstr::bstr::BStr; 1]>>::as_slice Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]>>::as_slice |
1341 | | |
1342 | | /// Extracts a mutable slice of the entire vector. |
1343 | | /// |
1344 | | /// Equivalent to `&mut s[..]`. |
1345 | | pub fn as_mut_slice(&mut self) -> &mut [A::Item] { |
1346 | | self |
1347 | | } |
1348 | | |
1349 | | /// Remove the element at position `index`, replacing it with the last element. |
1350 | | /// |
1351 | | /// This does not preserve ordering, but is O(1). |
1352 | | /// |
1353 | | /// Panics if `index` is out of bounds. |
1354 | | #[inline] |
1355 | | pub fn swap_remove(&mut self, index: usize) -> A::Item { |
1356 | | let len = self.len(); |
1357 | | self.swap(len - 1, index); |
1358 | | self.pop() |
1359 | | .unwrap_or_else(|| unsafe { unreachable_unchecked() }) |
1360 | | } |
1361 | | |
1362 | | /// Remove all elements from the vector. |
1363 | | #[inline] |
1364 | 6.92k | pub fn clear(&mut self) { |
1365 | 6.92k | self.truncate(0); |
1366 | 6.92k | } Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::clear Unexecuted instantiation: <smallvec::SmallVec<[(gix_hash::object_id::ObjectId, i64); 2]>>::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 | 1364 | 6.92k | pub fn clear(&mut self) { | 1365 | 6.92k | self.truncate(0); | 1366 | 6.92k | } |
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 |
1367 | | |
1368 | | /// Remove and return the element at position `index`, shifting all elements after it to the |
1369 | | /// left. |
1370 | | /// |
1371 | | /// Panics if `index` is out of bounds. |
1372 | | pub fn remove(&mut self, index: usize) -> A::Item { |
1373 | | unsafe { |
1374 | | let (ptr, len_ptr, _) = self.triple_mut(); |
1375 | | let len = *len_ptr; |
1376 | | assert!(index < len); |
1377 | | *len_ptr = len - 1; |
1378 | | let ptr = ptr.as_ptr().add(index); |
1379 | | let item = ptr::read(ptr); |
1380 | | ptr::copy(ptr.add(1), ptr, len - index - 1); |
1381 | | item |
1382 | | } |
1383 | | } |
1384 | | |
1385 | | /// Insert an element at position `index`, shifting all elements after it to the right. |
1386 | | /// |
1387 | | /// Panics if `index > len`. |
1388 | | pub fn insert(&mut self, index: usize, element: A::Item) { |
1389 | | unsafe { |
1390 | | let (mut ptr, mut len_ptr, cap) = self.triple_mut(); |
1391 | | if *len_ptr == cap { |
1392 | | self.reserve_one_unchecked(); |
1393 | | let (heap_ptr, heap_len_ptr) = self.data.heap_mut(); |
1394 | | ptr = heap_ptr; |
1395 | | len_ptr = heap_len_ptr; |
1396 | | } |
1397 | | let mut ptr = ptr.as_ptr(); |
1398 | | let len = *len_ptr; |
1399 | | if index > len { |
1400 | | panic!("index exceeds length"); |
1401 | | } |
1402 | | // SAFETY: add is UB if index > len, but we panicked first |
1403 | | ptr = ptr.add(index); |
1404 | | if index < len { |
1405 | | // Shift element to the right of `index`. |
1406 | | ptr::copy(ptr, ptr.add(1), len - index); |
1407 | | } |
1408 | | *len_ptr = len + 1; |
1409 | | ptr::write(ptr, element); |
1410 | | } |
1411 | | } |
1412 | | |
1413 | | /// Insert multiple elements at position `index`, shifting all following elements toward the |
1414 | | /// back. |
1415 | | pub fn insert_many<I: IntoIterator<Item = A::Item>>(&mut self, index: usize, iterable: I) { |
1416 | | let mut iter = iterable.into_iter(); |
1417 | | if index == self.len() { |
1418 | | return self.extend(iter); |
1419 | | } |
1420 | | |
1421 | | let (lower_size_bound, _) = iter.size_hint(); |
1422 | | assert!(lower_size_bound <= core::isize::MAX as usize); // Ensure offset is indexable |
1423 | | assert!(index + lower_size_bound >= index); // Protect against overflow |
1424 | | |
1425 | | let mut num_added = 0; |
1426 | | let old_len = self.len(); |
1427 | | assert!(index <= old_len); |
1428 | | |
1429 | | unsafe { |
1430 | | // Reserve space for `lower_size_bound` elements. |
1431 | | self.reserve(lower_size_bound); |
1432 | | let start = self.as_mut_ptr(); |
1433 | | let ptr = start.add(index); |
1434 | | |
1435 | | // Move the trailing elements. |
1436 | | ptr::copy(ptr, ptr.add(lower_size_bound), old_len - index); |
1437 | | |
1438 | | // In case the iterator panics, don't double-drop the items we just copied above. |
1439 | | self.set_len(0); |
1440 | | let mut guard = DropOnPanic { |
1441 | | start, |
1442 | | skip: index..(index + lower_size_bound), |
1443 | | len: old_len + lower_size_bound, |
1444 | | }; |
1445 | | |
1446 | | // The set_len above invalidates the previous pointers, so we must re-create them. |
1447 | | let start = self.as_mut_ptr(); |
1448 | | let ptr = start.add(index); |
1449 | | |
1450 | | while num_added < lower_size_bound { |
1451 | | let element = match iter.next() { |
1452 | | Some(x) => x, |
1453 | | None => break, |
1454 | | }; |
1455 | | let cur = ptr.add(num_added); |
1456 | | ptr::write(cur, element); |
1457 | | guard.skip.start += 1; |
1458 | | num_added += 1; |
1459 | | } |
1460 | | |
1461 | | if num_added < lower_size_bound { |
1462 | | // Iterator provided fewer elements than the hint. Move the tail backward. |
1463 | | ptr::copy( |
1464 | | ptr.add(lower_size_bound), |
1465 | | ptr.add(num_added), |
1466 | | old_len - index, |
1467 | | ); |
1468 | | } |
1469 | | // There are no more duplicate or uninitialized slots, so the guard is not needed. |
1470 | | self.set_len(old_len + num_added); |
1471 | | mem::forget(guard); |
1472 | | } |
1473 | | |
1474 | | // Insert any remaining elements one-by-one. |
1475 | | for element in iter { |
1476 | | self.insert(index + num_added, element); |
1477 | | num_added += 1; |
1478 | | } |
1479 | | |
1480 | | struct DropOnPanic<T> { |
1481 | | start: *mut T, |
1482 | | skip: Range<usize>, // Space we copied-out-of, but haven't written-to yet. |
1483 | | len: usize, |
1484 | | } |
1485 | | |
1486 | | impl<T> Drop for DropOnPanic<T> { |
1487 | | fn drop(&mut self) { |
1488 | | for i in 0..self.len { |
1489 | | if !self.skip.contains(&i) { |
1490 | | unsafe { |
1491 | | ptr::drop_in_place(self.start.add(i)); |
1492 | | } |
1493 | | } |
1494 | | } |
1495 | | } |
1496 | | } |
1497 | | } |
1498 | | |
1499 | | /// Convert a `SmallVec` to a `Vec`, without reallocating if the `SmallVec` has already spilled onto |
1500 | | /// the heap. |
1501 | | pub fn into_vec(mut self) -> Vec<A::Item> { |
1502 | | if self.spilled() { |
1503 | | unsafe { |
1504 | | let (ptr, &mut len) = self.data.heap_mut(); |
1505 | | let v = Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity); |
1506 | | mem::forget(self); |
1507 | | v |
1508 | | } |
1509 | | } else { |
1510 | | self.into_iter().collect() |
1511 | | } |
1512 | | } |
1513 | | |
1514 | | /// Converts a `SmallVec` into a `Box<[T]>` without reallocating if the `SmallVec` has already spilled |
1515 | | /// onto the heap. |
1516 | | /// |
1517 | | /// Note that this will drop any excess capacity. |
1518 | | pub fn into_boxed_slice(self) -> Box<[A::Item]> { |
1519 | | self.into_vec().into_boxed_slice() |
1520 | | } |
1521 | | |
1522 | | /// Convert the `SmallVec` into an `A` if possible. Otherwise return `Err(Self)`. |
1523 | | /// |
1524 | | /// This method returns `Err(Self)` if the `SmallVec` is too short (and the `A` contains uninitialized elements), |
1525 | | /// or if the `SmallVec` is too long (and all the elements were spilled to the heap). |
1526 | | pub fn into_inner(self) -> Result<A, Self> { |
1527 | | if self.spilled() || self.len() != A::size() { |
1528 | | // Note: A::size, not Self::inline_capacity |
1529 | | Err(self) |
1530 | | } else { |
1531 | | unsafe { |
1532 | | let data = ptr::read(&self.data); |
1533 | | mem::forget(self); |
1534 | | Ok(data.into_inline().assume_init()) |
1535 | | } |
1536 | | } |
1537 | | } |
1538 | | |
1539 | | /// Retains only the elements specified by the predicate. |
1540 | | /// |
1541 | | /// In other words, remove all elements `e` such that `f(&e)` returns `false`. |
1542 | | /// This method operates in place and preserves the order of the retained |
1543 | | /// elements. |
1544 | | pub fn retain<F: FnMut(&mut A::Item) -> bool>(&mut self, mut f: F) { |
1545 | | let mut del = 0; |
1546 | | let len = self.len(); |
1547 | | for i in 0..len { |
1548 | | if !f(&mut self[i]) { |
1549 | | del += 1; |
1550 | | } else if del > 0 { |
1551 | | self.swap(i - del, i); |
1552 | | } |
1553 | | } |
1554 | | self.truncate(len - del); |
1555 | | } |
1556 | | |
1557 | | /// Retains only the elements specified by the predicate. |
1558 | | /// |
1559 | | /// This method is identical in behaviour to [`retain`]; it is included only |
1560 | | /// to maintain api-compatibility with `std::Vec`, where the methods are |
1561 | | /// separate for historical reasons. |
1562 | | pub fn retain_mut<F: FnMut(&mut A::Item) -> bool>(&mut self, f: F) { |
1563 | | self.retain(f) |
1564 | | } |
1565 | | |
1566 | | /// Removes consecutive duplicate elements. |
1567 | | pub fn dedup(&mut self) |
1568 | | where |
1569 | | A::Item: PartialEq<A::Item>, |
1570 | | { |
1571 | | self.dedup_by(|a, b| a == b); |
1572 | | } |
1573 | | |
1574 | | /// Removes consecutive duplicate elements using the given equality relation. |
1575 | | pub fn dedup_by<F>(&mut self, mut same_bucket: F) |
1576 | | where |
1577 | | F: FnMut(&mut A::Item, &mut A::Item) -> bool, |
1578 | | { |
1579 | | // See the implementation of Vec::dedup_by in the |
1580 | | // standard library for an explanation of this algorithm. |
1581 | | let len = self.len(); |
1582 | | if len <= 1 { |
1583 | | return; |
1584 | | } |
1585 | | |
1586 | | let ptr = self.as_mut_ptr(); |
1587 | | let mut w: usize = 1; |
1588 | | |
1589 | | unsafe { |
1590 | | for r in 1..len { |
1591 | | let p_r = ptr.add(r); |
1592 | | let p_wm1 = ptr.add(w - 1); |
1593 | | if !same_bucket(&mut *p_r, &mut *p_wm1) { |
1594 | | if r != w { |
1595 | | let p_w = p_wm1.add(1); |
1596 | | mem::swap(&mut *p_r, &mut *p_w); |
1597 | | } |
1598 | | w += 1; |
1599 | | } |
1600 | | } |
1601 | | } |
1602 | | |
1603 | | self.truncate(w); |
1604 | | } |
1605 | | |
1606 | | /// Removes consecutive elements that map to the same key. |
1607 | | pub fn dedup_by_key<F, K>(&mut self, mut key: F) |
1608 | | where |
1609 | | F: FnMut(&mut A::Item) -> K, |
1610 | | K: PartialEq<K>, |
1611 | | { |
1612 | | self.dedup_by(|a, b| key(a) == key(b)); |
1613 | | } |
1614 | | |
1615 | | /// Resizes the `SmallVec` in-place so that `len` is equal to `new_len`. |
1616 | | /// |
1617 | | /// If `new_len` is greater than `len`, the `SmallVec` is extended by the difference, with each |
1618 | | /// additional slot filled with the result of calling the closure `f`. The return values from `f` |
1619 | | /// will end up in the `SmallVec` in the order they have been generated. |
1620 | | /// |
1621 | | /// If `new_len` is less than `len`, the `SmallVec` is simply truncated. |
1622 | | /// |
1623 | | /// This method uses a closure to create new values on every push. If you'd rather `Clone` a given |
1624 | | /// value, use `resize`. If you want to use the `Default` trait to generate values, you can pass |
1625 | | /// `Default::default()` as the second argument. |
1626 | | /// |
1627 | | /// Added for `std::vec::Vec` compatibility (added in Rust 1.33.0) |
1628 | | /// |
1629 | | /// ``` |
1630 | | /// # use smallvec::{smallvec, SmallVec}; |
1631 | | /// let mut vec : SmallVec<[_; 4]> = smallvec![1, 2, 3]; |
1632 | | /// vec.resize_with(5, Default::default); |
1633 | | /// assert_eq!(&*vec, &[1, 2, 3, 0, 0]); |
1634 | | /// |
1635 | | /// let mut vec : SmallVec<[_; 4]> = smallvec![]; |
1636 | | /// let mut p = 1; |
1637 | | /// vec.resize_with(4, || { p *= 2; p }); |
1638 | | /// assert_eq!(&*vec, &[2, 4, 8, 16]); |
1639 | | /// ``` |
1640 | | pub fn resize_with<F>(&mut self, new_len: usize, f: F) |
1641 | | where |
1642 | | F: FnMut() -> A::Item, |
1643 | | { |
1644 | | let old_len = self.len(); |
1645 | | if old_len < new_len { |
1646 | | let mut f = f; |
1647 | | let additional = new_len - old_len; |
1648 | | self.reserve(additional); |
1649 | | for _ in 0..additional { |
1650 | | self.push(f()); |
1651 | | } |
1652 | | } else if old_len > new_len { |
1653 | | self.truncate(new_len); |
1654 | | } |
1655 | | } |
1656 | | |
1657 | | /// Creates a `SmallVec` directly from the raw components of another |
1658 | | /// `SmallVec`. |
1659 | | /// |
1660 | | /// # Safety |
1661 | | /// |
1662 | | /// This is highly unsafe, due to the number of invariants that aren't |
1663 | | /// checked: |
1664 | | /// |
1665 | | /// * `ptr` needs to have been previously allocated via `SmallVec` for its |
1666 | | /// spilled storage (at least, it's highly likely to be incorrect if it |
1667 | | /// wasn't). |
1668 | | /// * `ptr`'s `A::Item` type needs to be the same size and alignment that |
1669 | | /// it was allocated with |
1670 | | /// * `length` needs to be less than or equal to `capacity`. |
1671 | | /// * `capacity` needs to be the capacity that the pointer was allocated |
1672 | | /// with. |
1673 | | /// |
1674 | | /// Violating these may cause problems like corrupting the allocator's |
1675 | | /// internal data structures. |
1676 | | /// |
1677 | | /// Additionally, `capacity` must be greater than the amount of inline |
1678 | | /// storage `A` has; that is, the new `SmallVec` must need to spill over |
1679 | | /// into heap allocated storage. This condition is asserted against. |
1680 | | /// |
1681 | | /// The ownership of `ptr` is effectively transferred to the |
1682 | | /// `SmallVec` which may then deallocate, reallocate or change the |
1683 | | /// contents of memory pointed to by the pointer at will. Ensure |
1684 | | /// that nothing else uses the pointer after calling this |
1685 | | /// function. |
1686 | | /// |
1687 | | /// # Examples |
1688 | | /// |
1689 | | /// ``` |
1690 | | /// # use smallvec::{smallvec, SmallVec}; |
1691 | | /// use std::mem; |
1692 | | /// use std::ptr; |
1693 | | /// |
1694 | | /// fn main() { |
1695 | | /// let mut v: SmallVec<[_; 1]> = smallvec![1, 2, 3]; |
1696 | | /// |
1697 | | /// // Pull out the important parts of `v`. |
1698 | | /// let p = v.as_mut_ptr(); |
1699 | | /// let len = v.len(); |
1700 | | /// let cap = v.capacity(); |
1701 | | /// let spilled = v.spilled(); |
1702 | | /// |
1703 | | /// unsafe { |
1704 | | /// // Forget all about `v`. The heap allocation that stored the |
1705 | | /// // three values won't be deallocated. |
1706 | | /// mem::forget(v); |
1707 | | /// |
1708 | | /// // Overwrite memory with [4, 5, 6]. |
1709 | | /// // |
1710 | | /// // This is only safe if `spilled` is true! Otherwise, we are |
1711 | | /// // writing into the old `SmallVec`'s inline storage on the |
1712 | | /// // stack. |
1713 | | /// assert!(spilled); |
1714 | | /// for i in 0..len { |
1715 | | /// ptr::write(p.add(i), 4 + i); |
1716 | | /// } |
1717 | | /// |
1718 | | /// // Put everything back together into a SmallVec with a different |
1719 | | /// // amount of inline storage, but which is still less than `cap`. |
1720 | | /// let rebuilt = SmallVec::<[_; 2]>::from_raw_parts(p, len, cap); |
1721 | | /// assert_eq!(&*rebuilt, &[4, 5, 6]); |
1722 | | /// } |
1723 | | /// } |
1724 | | #[inline] |
1725 | | pub unsafe fn from_raw_parts(ptr: *mut A::Item, length: usize, capacity: usize) -> SmallVec<A> { |
1726 | | // SAFETY: We require caller to provide same ptr as we alloc |
1727 | | // and we never alloc null pointer. |
1728 | | let ptr = unsafe { |
1729 | | debug_assert!(!ptr.is_null(), "Called `from_raw_parts` with null pointer."); |
1730 | | NonNull::new_unchecked(ptr) |
1731 | | }; |
1732 | | assert!(capacity > Self::inline_capacity()); |
1733 | | SmallVec { |
1734 | | capacity, |
1735 | | data: SmallVecData::from_heap(ptr, length), |
1736 | | } |
1737 | | } |
1738 | | |
1739 | | /// Returns a raw pointer to the vector's buffer. |
1740 | 9.14M | pub fn as_ptr(&self) -> *const A::Item { |
1741 | | // We shadow the slice method of the same name to avoid going through |
1742 | | // `deref`, which creates an intermediate reference that may place |
1743 | | // additional safety constraints on the contents of the slice. |
1744 | 9.14M | self.triple().0.as_ptr() |
1745 | 9.14M | } <smallvec::SmallVec<[gix_config::parse::Event; 8]>>::as_ptr Line | Count | Source | 1740 | 9.14M | pub fn as_ptr(&self) -> *const A::Item { | 1741 | | // We shadow the slice method of the same name to avoid going through | 1742 | | // `deref`, which creates an intermediate reference that may place | 1743 | | // additional safety constraints on the contents of the slice. | 1744 | 9.14M | self.triple().0.as_ptr() | 1745 | 9.14M | } |
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_pack::data::file::decode::entry::Delta; 10]>>::as_ptr <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]>>::as_ptr Line | Count | Source | 1740 | 162 | pub fn as_ptr(&self) -> *const A::Item { | 1741 | | // We shadow the slice method of the same name to avoid going through | 1742 | | // `deref`, which creates an intermediate reference that may place | 1743 | | // additional safety constraints on the contents of the slice. | 1744 | 162 | self.triple().0.as_ptr() | 1745 | 162 | } |
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 |
1746 | | |
1747 | | /// Returns a raw mutable pointer to the vector's buffer. |
1748 | 470 | pub fn as_mut_ptr(&mut self) -> *mut A::Item { |
1749 | | // We shadow the slice method of the same name to avoid going through |
1750 | | // `deref_mut`, which creates an intermediate reference that may place |
1751 | | // additional safety constraints on the contents of the slice. |
1752 | 470 | self.triple_mut().0.as_ptr() |
1753 | 470 | } Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr <smallvec::SmallVec<[u8; 256]>>::as_mut_ptr Line | Count | Source | 1748 | 470 | pub fn as_mut_ptr(&mut self) -> *mut A::Item { | 1749 | | // We shadow the slice method of the same name to avoid going through | 1750 | | // `deref_mut`, which creates an intermediate reference that may place | 1751 | | // additional safety constraints on the contents of the slice. | 1752 | 470 | self.triple_mut().0.as_ptr() | 1753 | 470 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::as_mut_ptr |
1754 | | } |
1755 | | |
1756 | | impl<A: Array> SmallVec<A> |
1757 | | where |
1758 | | A::Item: Copy, |
1759 | | { |
1760 | | /// Copy the elements from a slice into a new `SmallVec`. |
1761 | | /// |
1762 | | /// For slices of `Copy` types, this is more efficient than `SmallVec::from(slice)`. |
1763 | | pub fn from_slice(slice: &[A::Item]) -> Self { |
1764 | | let len = slice.len(); |
1765 | | if len <= Self::inline_capacity() { |
1766 | | SmallVec { |
1767 | | capacity: len, |
1768 | | data: SmallVecData::from_inline(unsafe { |
1769 | | let mut data: MaybeUninit<A> = MaybeUninit::uninit(); |
1770 | | ptr::copy_nonoverlapping( |
1771 | | slice.as_ptr(), |
1772 | | data.as_mut_ptr() as *mut A::Item, |
1773 | | len, |
1774 | | ); |
1775 | | data |
1776 | | }), |
1777 | | } |
1778 | | } else { |
1779 | | let mut b = slice.to_vec(); |
1780 | | let cap = b.capacity(); |
1781 | | let ptr = NonNull::new(b.as_mut_ptr()).expect("Vec always contain non null pointers."); |
1782 | | mem::forget(b); |
1783 | | SmallVec { |
1784 | | capacity: cap, |
1785 | | data: SmallVecData::from_heap(ptr, len), |
1786 | | } |
1787 | | } |
1788 | | } |
1789 | | |
1790 | | /// Copy elements from a slice into the vector at position `index`, shifting any following |
1791 | | /// elements toward the back. |
1792 | | /// |
1793 | | /// For slices of `Copy` types, this is more efficient than `insert`. |
1794 | | #[inline] |
1795 | 470 | pub fn insert_from_slice(&mut self, index: usize, slice: &[A::Item]) { |
1796 | 470 | self.reserve(slice.len()); |
1797 | | |
1798 | 470 | let len = self.len(); |
1799 | 470 | assert!(index <= len); |
1800 | | |
1801 | 470 | unsafe { |
1802 | 470 | let slice_ptr = slice.as_ptr(); |
1803 | 470 | let ptr = self.as_mut_ptr().add(index); |
1804 | 470 | ptr::copy(ptr, ptr.add(slice.len()), len - index); |
1805 | 470 | ptr::copy_nonoverlapping(slice_ptr, ptr, slice.len()); |
1806 | 470 | self.set_len(len + slice.len()); |
1807 | 470 | } |
1808 | 470 | } Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice <smallvec::SmallVec<[u8; 256]>>::insert_from_slice Line | Count | Source | 1795 | 470 | pub fn insert_from_slice(&mut self, index: usize, slice: &[A::Item]) { | 1796 | 470 | self.reserve(slice.len()); | 1797 | | | 1798 | 470 | let len = self.len(); | 1799 | 470 | assert!(index <= len); | 1800 | | | 1801 | 470 | unsafe { | 1802 | 470 | let slice_ptr = slice.as_ptr(); | 1803 | 470 | let ptr = self.as_mut_ptr().add(index); | 1804 | 470 | ptr::copy(ptr, ptr.add(slice.len()), len - index); | 1805 | 470 | ptr::copy_nonoverlapping(slice_ptr, ptr, slice.len()); | 1806 | 470 | self.set_len(len + slice.len()); | 1807 | 470 | } | 1808 | 470 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::insert_from_slice |
1809 | | |
1810 | | /// Copy elements from a slice and append them to the vector. |
1811 | | /// |
1812 | | /// For slices of `Copy` types, this is more efficient than `extend`. |
1813 | | #[inline] |
1814 | 470 | pub fn extend_from_slice(&mut self, slice: &[A::Item]) { |
1815 | 470 | let len = self.len(); |
1816 | 470 | self.insert_from_slice(len, slice); |
1817 | 470 | } Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice <smallvec::SmallVec<[u8; 256]>>::extend_from_slice Line | Count | Source | 1814 | 470 | pub fn extend_from_slice(&mut self, slice: &[A::Item]) { | 1815 | 470 | let len = self.len(); | 1816 | 470 | self.insert_from_slice(len, slice); | 1817 | 470 | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]>>::extend_from_slice |
1818 | | } |
1819 | | |
1820 | | impl<A: Array> SmallVec<A> |
1821 | | where |
1822 | | A::Item: Clone, |
1823 | | { |
1824 | | /// Resizes the vector so that its length is equal to `len`. |
1825 | | /// |
1826 | | /// If `len` is less than the current length, the vector simply truncated. |
1827 | | /// |
1828 | | /// If `len` is greater than the current length, `value` is appended to the |
1829 | | /// vector until its length equals `len`. |
1830 | | pub fn resize(&mut self, len: usize, value: A::Item) { |
1831 | | let old_len = self.len(); |
1832 | | |
1833 | | if len > old_len { |
1834 | | self.extend(repeat(value).take(len - old_len)); |
1835 | | } else { |
1836 | | self.truncate(len); |
1837 | | } |
1838 | | } |
1839 | | |
1840 | | /// Creates a `SmallVec` with `n` copies of `elem`. |
1841 | | /// ``` |
1842 | | /// use smallvec::SmallVec; |
1843 | | /// |
1844 | | /// let v = SmallVec::<[char; 128]>::from_elem('d', 2); |
1845 | | /// assert_eq!(v, SmallVec::from_buf(['d', 'd'])); |
1846 | | /// ``` |
1847 | | pub fn from_elem(elem: A::Item, n: usize) -> Self { |
1848 | | if n > Self::inline_capacity() { |
1849 | | vec![elem; n].into() |
1850 | | } else { |
1851 | | let mut v = SmallVec::<A>::new(); |
1852 | | unsafe { |
1853 | | let (ptr, len_ptr, _) = v.triple_mut(); |
1854 | | let ptr = ptr.as_ptr(); |
1855 | | let mut local_len = SetLenOnDrop::new(len_ptr); |
1856 | | |
1857 | | for i in 0..n { |
1858 | | ::core::ptr::write(ptr.add(i), elem.clone()); |
1859 | | local_len.increment_len(1); |
1860 | | } |
1861 | | } |
1862 | | v |
1863 | | } |
1864 | | } |
1865 | | } |
1866 | | |
1867 | | impl<A: Array> ops::Deref for SmallVec<A> { |
1868 | | type Target = [A::Item]; |
1869 | | #[inline] |
1870 | 917k | fn deref(&self) -> &[A::Item] { |
1871 | | unsafe { |
1872 | 917k | let (ptr, len, _) = self.triple(); |
1873 | 917k | slice::from_raw_parts(ptr.as_ptr(), len) |
1874 | | } |
1875 | 917k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::Deref>::deref Line | Count | Source | 1870 | 6.18k | fn deref(&self) -> &[A::Item] { | 1871 | | unsafe { | 1872 | 6.18k | let (ptr, len, _) = self.triple(); | 1873 | 6.18k | slice::from_raw_parts(ptr.as_ptr(), len) | 1874 | | } | 1875 | 6.18k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::Deref>::deref Line | Count | Source | 1870 | 71.7k | fn deref(&self) -> &[A::Item] { | 1871 | | unsafe { | 1872 | 71.7k | let (ptr, len, _) = self.triple(); | 1873 | 71.7k | slice::from_raw_parts(ptr.as_ptr(), len) | 1874 | | } | 1875 | 71.7k | } |
<smallvec::SmallVec<[u8; 2]> as core::ops::deref::Deref>::deref Line | Count | Source | 1870 | 67.7k | fn deref(&self) -> &[A::Item] { | 1871 | | unsafe { | 1872 | 67.7k | let (ptr, len, _) = self.triple(); | 1873 | 67.7k | slice::from_raw_parts(ptr.as_ptr(), len) | 1874 | | } | 1875 | 67.7k | } |
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_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_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 <smallvec::SmallVec<[u8; 23]> as core::ops::deref::Deref>::deref Line | Count | Source | 1870 | 69.7k | fn deref(&self) -> &[A::Item] { | 1871 | | unsafe { | 1872 | 69.7k | let (ptr, len, _) = self.triple(); | 1873 | 69.7k | slice::from_raw_parts(ptr.as_ptr(), len) | 1874 | | } | 1875 | 69.7k | } |
<smallvec::SmallVec<[u8; 23]> as core::ops::deref::Deref>::deref Line | Count | Source | 1870 | 671k | fn deref(&self) -> &[A::Item] { | 1871 | | unsafe { | 1872 | 671k | let (ptr, len, _) = self.triple(); | 1873 | 671k | slice::from_raw_parts(ptr.as_ptr(), len) | 1874 | | } | 1875 | 671k | } |
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 <smallvec::SmallVec<[u8; 256]> as core::ops::deref::Deref>::deref Line | Count | Source | 1870 | 940 | fn deref(&self) -> &[A::Item] { | 1871 | | unsafe { | 1872 | 940 | let (ptr, len, _) = self.triple(); | 1873 | 940 | slice::from_raw_parts(ptr.as_ptr(), len) | 1874 | | } | 1875 | 940 | } |
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 | 1870 | 29.3k | fn deref(&self) -> &[A::Item] { | 1871 | | unsafe { | 1872 | 29.3k | let (ptr, len, _) = self.triple(); | 1873 | 29.3k | slice::from_raw_parts(ptr.as_ptr(), len) | 1874 | | } | 1875 | 29.3k | } |
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_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 |
1876 | | } |
1877 | | |
1878 | | impl<A: Array> ops::DerefMut for SmallVec<A> { |
1879 | | #[inline] |
1880 | 399k | fn deref_mut(&mut self) -> &mut [A::Item] { |
1881 | 399k | unsafe { |
1882 | 399k | let (ptr, &mut len, _) = self.triple_mut(); |
1883 | 399k | slice::from_raw_parts_mut(ptr.as_ptr(), len) |
1884 | 399k | } |
1885 | 399k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 24.0k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 24.0k | unsafe { | 1882 | 24.0k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 24.0k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 24.0k | } | 1885 | 24.0k | } |
<smallvec::SmallVec<[u8; 2]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 42.0k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 42.0k | unsafe { | 1882 | 42.0k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 42.0k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 42.0k | } | 1885 | 42.0k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 31.3k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 31.3k | unsafe { | 1882 | 31.3k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 31.3k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 31.3k | } | 1885 | 31.3k | } |
<smallvec::SmallVec<[u8; 2]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 6.18k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 6.18k | unsafe { | 1882 | 6.18k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 6.18k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 6.18k | } | 1885 | 6.18k | } |
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; 28]> 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 Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> 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_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; 28]> as core::ops::deref::DerefMut>::deref_mut <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 6.35k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 6.35k | unsafe { | 1882 | 6.35k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 6.35k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 6.35k | } | 1885 | 6.35k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::deref::DerefMut>::deref_mut <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 1.80k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 1.80k | unsafe { | 1882 | 1.80k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 1.80k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 1.80k | } | 1885 | 1.80k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::deref::DerefMut>::deref_mut <smallvec::SmallVec<[u8; 23]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 72.3k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 72.3k | unsafe { | 1882 | 72.3k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 72.3k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 72.3k | } | 1885 | 72.3k | } |
<smallvec::SmallVec<[u8; 23]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 127k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 127k | unsafe { | 1882 | 127k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 127k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 127k | } | 1885 | 127k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> 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; 28]> as core::ops::deref::DerefMut>::deref_mut <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 270 | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 270 | unsafe { | 1882 | 270 | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 270 | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 270 | } | 1885 | 270 | } |
<smallvec::SmallVec<[u8; 256]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 721 | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 721 | unsafe { | 1882 | 721 | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 721 | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 721 | } | 1885 | 721 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 5.72k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 5.72k | unsafe { | 1882 | 5.72k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 5.72k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 5.72k | } | 1885 | 5.72k | } |
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 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; 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 | 1880 | 46.3k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 46.3k | unsafe { | 1882 | 46.3k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 46.3k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 46.3k | } | 1885 | 46.3k | } |
<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 | 1880 | 6.92k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 6.92k | unsafe { | 1882 | 6.92k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 6.92k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 6.92k | } | 1885 | 6.92k | } |
<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 | 1880 | 6.52k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 6.52k | unsafe { | 1882 | 6.52k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 6.52k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 6.52k | } | 1885 | 6.52k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 1880 | 17.2k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 17.2k | unsafe { | 1882 | 17.2k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 17.2k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 17.2k | } | 1885 | 17.2k | } |
<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 | 1880 | 4.55k | fn deref_mut(&mut self) -> &mut [A::Item] { | 1881 | 4.55k | unsafe { | 1882 | 4.55k | let (ptr, &mut len, _) = self.triple_mut(); | 1883 | 4.55k | slice::from_raw_parts_mut(ptr.as_ptr(), len) | 1884 | 4.55k | } | 1885 | 4.55k | } |
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_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; 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 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 |
1886 | | } |
1887 | | |
1888 | | impl<A: Array> AsRef<[A::Item]> for SmallVec<A> { |
1889 | | #[inline] |
1890 | 27.2k | fn as_ref(&self) -> &[A::Item] { |
1891 | 27.2k | self |
1892 | 27.2k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::convert::AsRef<[gix_config::parse::Event]>>::as_ref Line | Count | Source | 1890 | 13.9k | fn as_ref(&self) -> &[A::Item] { | 1891 | 13.9k | self | 1892 | 13.9k | } |
<smallvec::SmallVec<[u8; 2]> as core::convert::AsRef<[u8]>>::as_ref Line | Count | Source | 1890 | 13.3k | fn as_ref(&self) -> &[A::Item] { | 1891 | 13.3k | self | 1892 | 13.3k | } |
|
1893 | | } |
1894 | | |
1895 | | impl<A: Array> AsMut<[A::Item]> for SmallVec<A> { |
1896 | | #[inline] |
1897 | | fn as_mut(&mut self) -> &mut [A::Item] { |
1898 | | self |
1899 | | } |
1900 | | } |
1901 | | |
1902 | | impl<A: Array> Borrow<[A::Item]> for SmallVec<A> { |
1903 | | #[inline] |
1904 | | fn borrow(&self) -> &[A::Item] { |
1905 | | self |
1906 | | } |
1907 | | } |
1908 | | |
1909 | | impl<A: Array> BorrowMut<[A::Item]> for SmallVec<A> { |
1910 | | #[inline] |
1911 | | fn borrow_mut(&mut self) -> &mut [A::Item] { |
1912 | | self |
1913 | | } |
1914 | | } |
1915 | | |
1916 | | #[cfg(feature = "write")] |
1917 | | #[cfg_attr(docsrs, doc(cfg(feature = "write")))] |
1918 | | impl<A: Array<Item = u8>> io::Write for SmallVec<A> { |
1919 | | #[inline] |
1920 | | fn write(&mut self, buf: &[u8]) -> io::Result<usize> { |
1921 | | self.extend_from_slice(buf); |
1922 | | Ok(buf.len()) |
1923 | | } |
1924 | | |
1925 | | #[inline] |
1926 | 0 | fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { |
1927 | 0 | self.extend_from_slice(buf); |
1928 | 0 | Ok(()) |
1929 | 0 | } Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as std::io::Write>::write_all |
1930 | | |
1931 | | #[inline] |
1932 | | fn flush(&mut self) -> io::Result<()> { |
1933 | | Ok(()) |
1934 | | } |
1935 | | } |
1936 | | |
1937 | | #[cfg(feature = "serde")] |
1938 | | #[cfg_attr(docsrs, doc(cfg(feature = "serde")))] |
1939 | | impl<A: Array> Serialize for SmallVec<A> |
1940 | | where |
1941 | | A::Item: Serialize, |
1942 | | { |
1943 | | fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { |
1944 | | let mut state = serializer.serialize_seq(Some(self.len()))?; |
1945 | | for item in self { |
1946 | | state.serialize_element(&item)?; |
1947 | | } |
1948 | | state.end() |
1949 | | } |
1950 | | } |
1951 | | |
1952 | | #[cfg(feature = "serde")] |
1953 | | #[cfg_attr(docsrs, doc(cfg(feature = "serde")))] |
1954 | | impl<'de, A: Array> Deserialize<'de> for SmallVec<A> |
1955 | | where |
1956 | | A::Item: Deserialize<'de>, |
1957 | | { |
1958 | | fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { |
1959 | | deserializer.deserialize_seq(SmallVecVisitor { |
1960 | | phantom: PhantomData, |
1961 | | }) |
1962 | | } |
1963 | | } |
1964 | | |
1965 | | #[cfg(feature = "serde")] |
1966 | | struct SmallVecVisitor<A> { |
1967 | | phantom: PhantomData<A>, |
1968 | | } |
1969 | | |
1970 | | #[cfg(feature = "serde")] |
1971 | | impl<'de, A: Array> Visitor<'de> for SmallVecVisitor<A> |
1972 | | where |
1973 | | A::Item: Deserialize<'de>, |
1974 | | { |
1975 | | type Value = SmallVec<A>; |
1976 | | |
1977 | | fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { |
1978 | | formatter.write_str("a sequence") |
1979 | | } |
1980 | | |
1981 | | fn visit_seq<B>(self, mut seq: B) -> Result<Self::Value, B::Error> |
1982 | | where |
1983 | | B: SeqAccess<'de>, |
1984 | | { |
1985 | | use serde::de::Error; |
1986 | | let len = seq.size_hint().unwrap_or(0); |
1987 | | let mut values = SmallVec::new(); |
1988 | | values.try_reserve(len).map_err(B::Error::custom)?; |
1989 | | |
1990 | | while let Some(value) = seq.next_element()? { |
1991 | | values.push(value); |
1992 | | } |
1993 | | |
1994 | | Ok(values) |
1995 | | } |
1996 | | } |
1997 | | |
1998 | | #[cfg(feature = "malloc_size_of")] |
1999 | | impl<A: Array> MallocShallowSizeOf for SmallVec<A> { |
2000 | | fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize { |
2001 | | if self.spilled() { |
2002 | | unsafe { ops.malloc_size_of(self.as_ptr()) } |
2003 | | } else { |
2004 | | 0 |
2005 | | } |
2006 | | } |
2007 | | } |
2008 | | |
2009 | | #[cfg(feature = "malloc_size_of")] |
2010 | | impl<A> MallocSizeOf for SmallVec<A> |
2011 | | where |
2012 | | A: Array, |
2013 | | A::Item: MallocSizeOf, |
2014 | | { |
2015 | | fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { |
2016 | | let mut n = self.shallow_size_of(ops); |
2017 | | for elem in self.iter() { |
2018 | | n += elem.size_of(ops); |
2019 | | } |
2020 | | n |
2021 | | } |
2022 | | } |
2023 | | |
2024 | | #[cfg(feature = "specialization")] |
2025 | | trait SpecFrom<A: Array, S> { |
2026 | | fn spec_from(slice: S) -> SmallVec<A>; |
2027 | | } |
2028 | | |
2029 | | #[cfg(feature = "specialization")] |
2030 | | mod specialization; |
2031 | | |
2032 | | #[cfg(feature = "arbitrary")] |
2033 | | mod arbitrary; |
2034 | | |
2035 | | #[cfg(feature = "specialization")] |
2036 | | impl<'a, A: Array> SpecFrom<A, &'a [A::Item]> for SmallVec<A> |
2037 | | where |
2038 | | A::Item: Copy, |
2039 | | { |
2040 | | #[inline] |
2041 | | fn spec_from(slice: &'a [A::Item]) -> SmallVec<A> { |
2042 | | SmallVec::from_slice(slice) |
2043 | | } |
2044 | | } |
2045 | | |
2046 | | impl<'a, A: Array> From<&'a [A::Item]> for SmallVec<A> |
2047 | | where |
2048 | | A::Item: Clone, |
2049 | | { |
2050 | | #[cfg(not(feature = "specialization"))] |
2051 | | #[inline] |
2052 | 272k | fn from(slice: &'a [A::Item]) -> SmallVec<A> { |
2053 | 272k | slice.iter().cloned().collect() |
2054 | 272k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::convert::From<&[gix_config::parse::Event]>>::from Line | Count | Source | 2052 | 6.18k | fn from(slice: &'a [A::Item]) -> SmallVec<A> { | 2053 | 6.18k | slice.iter().cloned().collect() | 2054 | 6.18k | } |
<smallvec::SmallVec<[u8; 2]> as core::convert::From<&[u8]>>::from Line | Count | Source | 2052 | 48.2k | fn from(slice: &'a [A::Item]) -> SmallVec<A> { | 2053 | 48.2k | slice.iter().cloned().collect() | 2054 | 48.2k | } |
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 <smallvec::SmallVec<[u8; 23]> as core::convert::From<&[u8]>>::from Line | Count | Source | 2052 | 25.4k | fn from(slice: &'a [A::Item]) -> SmallVec<A> { | 2053 | 25.4k | slice.iter().cloned().collect() | 2054 | 25.4k | } |
<smallvec::SmallVec<[u8; 23]> as core::convert::From<&[u8]>>::from Line | Count | Source | 2052 | 179k | fn from(slice: &'a [A::Item]) -> SmallVec<A> { | 2053 | 179k | slice.iter().cloned().collect() | 2054 | 179k | } |
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 | 2052 | 12.6k | fn from(slice: &'a [A::Item]) -> SmallVec<A> { | 2053 | 12.6k | slice.iter().cloned().collect() | 2054 | 12.6k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::convert::From<&[gix_hash::object_id::ObjectId]>>::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 |
2055 | | |
2056 | | #[cfg(feature = "specialization")] |
2057 | | #[inline] |
2058 | | fn from(slice: &'a [A::Item]) -> SmallVec<A> { |
2059 | | SmallVec::spec_from(slice) |
2060 | | } |
2061 | | } |
2062 | | |
2063 | | impl<A: Array> From<Vec<A::Item>> for SmallVec<A> { |
2064 | | #[inline] |
2065 | | fn from(vec: Vec<A::Item>) -> SmallVec<A> { |
2066 | | SmallVec::from_vec(vec) |
2067 | | } |
2068 | | } |
2069 | | |
2070 | | impl<A: Array> From<A> for SmallVec<A> { |
2071 | | #[inline] |
2072 | | fn from(array: A) -> SmallVec<A> { |
2073 | | SmallVec::from_buf(array) |
2074 | | } |
2075 | | } |
2076 | | |
2077 | | impl<A: Array, I: SliceIndex<[A::Item]>> ops::Index<I> for SmallVec<A> { |
2078 | | type Output = I::Output; |
2079 | | |
2080 | 198k | fn index(&self, index: I) -> &I::Output { |
2081 | 198k | &(**self)[index] |
2082 | 198k | } <smallvec::SmallVec<[u8; 23]> as core::ops::index::Index<core::ops::range::RangeFull>>::index Line | Count | Source | 2080 | 198k | fn index(&self, index: I) -> &I::Output { | 2081 | 198k | &(**self)[index] | 2082 | 198k | } |
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 |
2083 | | } |
2084 | | |
2085 | | impl<A: Array, I: SliceIndex<[A::Item]>> ops::IndexMut<I> for SmallVec<A> { |
2086 | 377k | fn index_mut(&mut self, index: I) -> &mut I::Output { |
2087 | 377k | &mut (&mut **self)[index] |
2088 | 377k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 24.0k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 24.0k | &mut (&mut **self)[index] | 2088 | 24.0k | } |
<smallvec::SmallVec<[u8; 2]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 42.0k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 42.0k | &mut (&mut **self)[index] | 2088 | 42.0k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 31.3k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 31.3k | &mut (&mut **self)[index] | 2088 | 31.3k | } |
<smallvec::SmallVec<[u8; 2]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 6.18k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 6.18k | &mut (&mut **self)[index] | 2088 | 6.18k | } |
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; 28]> 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 Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> 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_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; 28]> 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 | 2086 | 6.35k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 6.35k | &mut (&mut **self)[index] | 2088 | 6.35k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> 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 | 2086 | 1.80k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 1.80k | &mut (&mut **self)[index] | 2088 | 1.80k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut <smallvec::SmallVec<[u8; 23]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 72.3k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 72.3k | &mut (&mut **self)[index] | 2088 | 72.3k | } |
<smallvec::SmallVec<[u8; 23]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 127k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 127k | &mut (&mut **self)[index] | 2088 | 127k | } |
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_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; 28]> 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 | 2086 | 270 | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 270 | &mut (&mut **self)[index] | 2088 | 270 | } |
<smallvec::SmallVec<[u8; 256]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 251 | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 251 | &mut (&mut **self)[index] | 2088 | 251 | } |
<smallvec::SmallVec<[u8; 256]> as core::ops::index::IndexMut<usize>>::index_mut Line | Count | Source | 2086 | 470 | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 470 | &mut (&mut **self)[index] | 2088 | 470 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 3.56k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 3.56k | &mut (&mut **self)[index] | 2088 | 3.56k | } |
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 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; 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 | 2086 | 46.3k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 46.3k | &mut (&mut **self)[index] | 2088 | 46.3k | } |
<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 | 2086 | 6.92k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 6.92k | &mut (&mut **self)[index] | 2088 | 6.92k | } |
<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 | 2086 | 6.52k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 6.52k | &mut (&mut **self)[index] | 2088 | 6.52k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::index::IndexMut<core::ops::range::RangeFull>>::index_mut Line | Count | Source | 2086 | 1.48k | fn index_mut(&mut self, index: I) -> &mut I::Output { | 2087 | 1.48k | &mut (&mut **self)[index] | 2088 | 1.48k | } |
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_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; 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 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 |
2089 | | } |
2090 | | |
2091 | | #[allow(deprecated)] |
2092 | | impl<A: Array> ExtendFromSlice<A::Item> for SmallVec<A> |
2093 | | where |
2094 | | A::Item: Copy, |
2095 | | { |
2096 | | fn extend_from_slice(&mut self, other: &[A::Item]) { |
2097 | | SmallVec::extend_from_slice(self, other) |
2098 | | } |
2099 | | } |
2100 | | |
2101 | | impl<A: Array> FromIterator<A::Item> for SmallVec<A> { |
2102 | | #[inline] |
2103 | 307k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { |
2104 | 307k | let mut v = SmallVec::new(); |
2105 | 307k | v.extend(iterable); |
2106 | 307k | v |
2107 | 307k | } <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 | 2103 | 6.18k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { | 2104 | 6.18k | let mut v = SmallVec::new(); | 2105 | 6.18k | v.extend(iterable); | 2106 | 6.18k | v | 2107 | 6.18k | } |
<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 | 2103 | 19.5k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { | 2104 | 19.5k | let mut v = SmallVec::new(); | 2105 | 19.5k | v.extend(iterable); | 2106 | 19.5k | v | 2107 | 19.5k | } |
<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 | 2103 | 48.2k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { | 2104 | 48.2k | let mut v = SmallVec::new(); | 2105 | 48.2k | v.extend(iterable); | 2106 | 48.2k | v | 2107 | 48.2k | } |
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>>> <smallvec::SmallVec<[u8; 23]> as core::iter::traits::collect::FromIterator<u8>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>> Line | Count | Source | 2103 | 25.4k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { | 2104 | 25.4k | let mut v = SmallVec::new(); | 2105 | 25.4k | v.extend(iterable); | 2106 | 25.4k | v | 2107 | 25.4k | } |
<smallvec::SmallVec<[u8; 23]> as core::iter::traits::collect::FromIterator<u8>>::from_iter::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>> Line | Count | Source | 2103 | 179k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { | 2104 | 179k | let mut v = SmallVec::new(); | 2105 | 179k | v.extend(iterable); | 2106 | 179k | v | 2107 | 179k | } |
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 | 2103 | 15.4k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { | 2104 | 15.4k | let mut v = SmallVec::new(); | 2105 | 15.4k | v.extend(iterable); | 2106 | 15.4k | v | 2107 | 15.4k | } |
<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 | 2103 | 12.6k | fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> { | 2104 | 12.6k | let mut v = SmallVec::new(); | 2105 | 12.6k | v.extend(iterable); | 2106 | 12.6k | v | 2107 | 12.6k | } |
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_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>>> |
2108 | | } |
2109 | | |
2110 | | impl<A: Array> Extend<A::Item> for SmallVec<A> { |
2111 | 313k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { |
2112 | 313k | let mut iter = iterable.into_iter(); |
2113 | 313k | let (lower_size_bound, _) = iter.size_hint(); |
2114 | 313k | self.reserve(lower_size_bound); |
2115 | | |
2116 | | unsafe { |
2117 | 313k | let (ptr, len_ptr, cap) = self.triple_mut(); |
2118 | 313k | let ptr = ptr.as_ptr(); |
2119 | 313k | let mut len = SetLenOnDrop::new(len_ptr); |
2120 | 52.3M | while len.get() < cap { |
2121 | 52.3M | if let Some(out) = iter.next() { |
2122 | 52.0M | ptr::write(ptr.add(len.get()), out); |
2123 | 52.0M | len.increment_len(1); |
2124 | 52.0M | } else { |
2125 | 300k | return; |
2126 | | } |
2127 | | } |
2128 | | } |
2129 | | |
2130 | 21.2k | for elem in iter { |
2131 | 21.2k | self.push(elem); |
2132 | 21.2k | } |
2133 | 313k | } <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 | 2111 | 6.18k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 6.18k | let mut iter = iterable.into_iter(); | 2113 | 6.18k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 6.18k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 6.18k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 6.18k | let ptr = ptr.as_ptr(); | 2119 | 6.18k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 9.14M | while len.get() < cap { | 2121 | 9.14M | if let Some(out) = iter.next() { | 2122 | 9.14M | ptr::write(ptr.add(len.get()), out); | 2123 | 9.14M | len.increment_len(1); | 2124 | 9.14M | } else { | 2125 | 6.11k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 77 | for elem in iter { | 2131 | 0 | self.push(elem); | 2132 | 0 | } | 2133 | 6.18k | } |
<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 | 2111 | 1.53k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 1.53k | let mut iter = iterable.into_iter(); | 2113 | 1.53k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 1.53k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 1.53k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 1.53k | let ptr = ptr.as_ptr(); | 2119 | 1.53k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 9.14M | while len.get() < cap { | 2121 | 9.14M | if let Some(out) = iter.next() { | 2122 | 9.14M | ptr::write(ptr.add(len.get()), out); | 2123 | 9.14M | len.increment_len(1); | 2124 | 9.14M | } else { | 2125 | 1.47k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 61 | for elem in iter { | 2131 | 0 | self.push(elem); | 2132 | 0 | } | 2133 | 1.53k | } |
<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 | 2111 | 19.5k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 19.5k | let mut iter = iterable.into_iter(); | 2113 | 19.5k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 19.5k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 19.5k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 19.5k | let ptr = ptr.as_ptr(); | 2119 | 19.5k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 31.3M | while len.get() < cap { | 2121 | 31.3M | if let Some(out) = iter.next() { | 2122 | 31.3M | ptr::write(ptr.add(len.get()), out); | 2123 | 31.3M | len.increment_len(1); | 2124 | 31.3M | } else { | 2125 | 19.4k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 162 | for elem in iter { | 2131 | 0 | self.push(elem); | 2132 | 0 | } | 2133 | 19.5k | } |
<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 | 2111 | 48.2k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 48.2k | let mut iter = iterable.into_iter(); | 2113 | 48.2k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 48.2k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 48.2k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 48.2k | let ptr = ptr.as_ptr(); | 2119 | 48.2k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 105k | while len.get() < cap { | 2121 | 96.5k | if let Some(out) = iter.next() { | 2122 | 57.1k | ptr::write(ptr.add(len.get()), out); | 2123 | 57.1k | len.increment_len(1); | 2124 | 57.1k | } else { | 2125 | 39.4k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 8.85k | for elem in iter { | 2131 | 0 | self.push(elem); | 2132 | 0 | } | 2133 | 48.2k | } |
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>>> <smallvec::SmallVec<[u8; 23]> as core::iter::traits::collect::Extend<u8>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>> Line | Count | Source | 2111 | 25.4k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 25.4k | let mut iter = iterable.into_iter(); | 2113 | 25.4k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 25.4k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 25.4k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 25.4k | let ptr = ptr.as_ptr(); | 2119 | 25.4k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 346k | while len.get() < cap { | 2121 | 346k | if let Some(out) = iter.next() { | 2122 | 320k | ptr::write(ptr.add(len.get()), out); | 2123 | 320k | len.increment_len(1); | 2124 | 320k | } else { | 2125 | 25.2k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 162 | for elem in iter { | 2131 | 0 | self.push(elem); | 2132 | 0 | } | 2133 | 25.4k | } |
<smallvec::SmallVec<[u8; 23]> as core::iter::traits::collect::Extend<u8>>::extend::<core::iter::adapters::cloned::Cloned<core::slice::iter::Iter<u8>>> Line | Count | Source | 2111 | 179k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 179k | let mut iter = iterable.into_iter(); | 2113 | 179k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 179k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 179k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 179k | let ptr = ptr.as_ptr(); | 2119 | 179k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 2.21M | while len.get() < cap { | 2121 | 2.21M | if let Some(out) = iter.next() { | 2122 | 2.03M | ptr::write(ptr.add(len.get()), out); | 2123 | 2.03M | len.increment_len(1); | 2124 | 2.03M | } else { | 2125 | 179k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 632 | for elem in iter { | 2131 | 0 | self.push(elem); | 2132 | 0 | } | 2133 | 179k | } |
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 | 2111 | 15.4k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 15.4k | let mut iter = iterable.into_iter(); | 2113 | 15.4k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 15.4k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 15.4k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 15.4k | let ptr = ptr.as_ptr(); | 2119 | 15.4k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 27.7k | while len.get() < cap { | 2121 | 26.0k | if let Some(out) = iter.next() { | 2122 | 12.2k | ptr::write(ptr.add(len.get()), out); | 2123 | 12.2k | len.increment_len(1); | 2124 | 12.2k | } else { | 2125 | 13.7k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 14.4k | for elem in iter { | 2131 | 14.4k | self.push(elem); | 2132 | 14.4k | } | 2133 | 15.4k | } |
<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 | 2111 | 14.5k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 14.5k | let mut iter = iterable.into_iter(); | 2113 | 14.5k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 14.5k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 14.5k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 14.5k | let ptr = ptr.as_ptr(); | 2119 | 14.5k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 24.2k | while len.get() < cap { | 2121 | 23.7k | if let Some(out) = iter.next() { | 2122 | 9.66k | ptr::write(ptr.add(len.get()), out); | 2123 | 9.66k | len.increment_len(1); | 2124 | 9.66k | } else { | 2125 | 14.1k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 440 | for elem in iter { | 2131 | 0 | self.push(elem); | 2132 | 0 | } | 2133 | 14.5k | } |
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 | 2111 | 2.31k | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 2.31k | let mut iter = iterable.into_iter(); | 2113 | 2.31k | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 2.31k | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 2.31k | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 2.31k | let ptr = ptr.as_ptr(); | 2119 | 2.31k | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 9.45k | while len.get() < cap { | 2121 | 9.04k | if let Some(out) = iter.next() { | 2122 | 7.13k | ptr::write(ptr.add(len.get()), out); | 2123 | 7.13k | len.increment_len(1); | 2124 | 7.13k | } else { | 2125 | 1.90k | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 5.98k | for elem in iter { | 2131 | 5.98k | self.push(elem); | 2132 | 5.98k | } | 2133 | 2.31k | } |
<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 | 2111 | 178 | fn extend<I: IntoIterator<Item = A::Item>>(&mut self, iterable: I) { | 2112 | 178 | let mut iter = iterable.into_iter(); | 2113 | 178 | let (lower_size_bound, _) = iter.size_hint(); | 2114 | 178 | self.reserve(lower_size_bound); | 2115 | | | 2116 | | unsafe { | 2117 | 178 | let (ptr, len_ptr, cap) = self.triple_mut(); | 2118 | 178 | let ptr = ptr.as_ptr(); | 2119 | 178 | let mut len = SetLenOnDrop::new(len_ptr); | 2120 | 853 | while len.get() < cap { | 2121 | 793 | if let Some(out) = iter.next() { | 2122 | 675 | ptr::write(ptr.add(len.get()), out); | 2123 | 675 | len.increment_len(1); | 2124 | 675 | } else { | 2125 | 118 | return; | 2126 | | } | 2127 | | } | 2128 | | } | 2129 | | | 2130 | 845 | for elem in iter { | 2131 | 845 | self.push(elem); | 2132 | 845 | } | 2133 | 178 | } |
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_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}>> |
2134 | | } |
2135 | | |
2136 | | impl<A: Array> fmt::Debug for SmallVec<A> |
2137 | | where |
2138 | | A::Item: fmt::Debug, |
2139 | | { |
2140 | 0 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
2141 | 0 | f.debug_list().entries(self.iter()).finish() |
2142 | 0 | } Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::fmt::Debug>::fmt Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::fmt::Debug>::fmt |
2143 | | } |
2144 | | |
2145 | | impl<A: Array> Default for SmallVec<A> { |
2146 | | #[inline] |
2147 | 77.1k | fn default() -> SmallVec<A> { |
2148 | 77.1k | SmallVec::new() |
2149 | 77.1k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::default::Default>::default Line | Count | Source | 2147 | 12.2k | fn default() -> SmallVec<A> { | 2148 | 12.2k | SmallVec::new() | 2149 | 12.2k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::default::Default>::default Line | Count | Source | 2147 | 25.5k | fn default() -> SmallVec<A> { | 2148 | 25.5k | SmallVec::new() | 2149 | 25.5k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> 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<[(gix_hash::object_id::ObjectId, i64); 2]> as core::default::Default>::default <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> as core::default::Default>::default Line | Count | Source | 2147 | 3.74k | fn default() -> SmallVec<A> { | 2148 | 3.74k | SmallVec::new() | 2149 | 3.74k | } |
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<[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 | 2147 | 6.92k | fn default() -> SmallVec<A> { | 2148 | 6.92k | SmallVec::new() | 2149 | 6.92k | } |
<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 | 2147 | 6.92k | fn default() -> SmallVec<A> { | 2148 | 6.92k | SmallVec::new() | 2149 | 6.92k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::default::Default>::default Line | Count | Source | 2147 | 21.7k | fn default() -> SmallVec<A> { | 2148 | 21.7k | SmallVec::new() | 2149 | 21.7k | } |
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 |
2150 | | } |
2151 | | |
2152 | | #[cfg(feature = "may_dangle")] |
2153 | | unsafe impl<#[may_dangle] A: Array> Drop for SmallVec<A> { |
2154 | | fn drop(&mut self) { |
2155 | | unsafe { |
2156 | | if self.spilled() { |
2157 | | let (ptr, &mut len) = self.data.heap_mut(); |
2158 | | Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity); |
2159 | | } else { |
2160 | | ptr::drop_in_place(&mut self[..]); |
2161 | | } |
2162 | | } |
2163 | | } |
2164 | | } |
2165 | | |
2166 | | #[cfg(not(feature = "may_dangle"))] |
2167 | | impl<A: Array> Drop for SmallVec<A> { |
2168 | 387k | fn drop(&mut self) { |
2169 | | unsafe { |
2170 | 387k | if self.spilled() { |
2171 | 10.4k | let (ptr, &mut len) = self.data.heap_mut(); |
2172 | 10.4k | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); |
2173 | 376k | } else { |
2174 | 376k | ptr::drop_in_place(&mut self[..]); |
2175 | 376k | } |
2176 | | } |
2177 | 387k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 25.2k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 25.2k | if self.spilled() { | 2171 | 1.11k | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 1.11k | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 24.0k | } else { | 2174 | 24.0k | ptr::drop_in_place(&mut self[..]); | 2175 | 24.0k | } | 2176 | | } | 2177 | 25.2k | } |
<smallvec::SmallVec<[u8; 2]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 42.0k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 42.0k | if self.spilled() { | 2171 | 0 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 0 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 42.0k | } else { | 2174 | 42.0k | ptr::drop_in_place(&mut self[..]); | 2175 | 42.0k | } | 2176 | | } | 2177 | 42.0k | } |
<smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 31.7k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 31.7k | if self.spilled() { | 2171 | 388 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 388 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 31.3k | } else { | 2174 | 31.3k | ptr::drop_in_place(&mut self[..]); | 2175 | 31.3k | } | 2176 | | } | 2177 | 31.7k | } |
<smallvec::SmallVec<[u8; 2]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 6.18k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 6.18k | if self.spilled() { | 2171 | 0 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 0 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 6.18k | } else { | 2174 | 6.18k | ptr::drop_in_place(&mut self[..]); | 2175 | 6.18k | } | 2176 | | } | 2177 | 6.18k | } |
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; 28]> 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 Unexecuted instantiation: <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> 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_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; 28]> as core::ops::drop::Drop>::drop <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 6.56k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 6.56k | if self.spilled() { | 2171 | 215 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 215 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 6.35k | } else { | 2174 | 6.35k | ptr::drop_in_place(&mut self[..]); | 2175 | 6.35k | } | 2176 | | } | 2177 | 6.56k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> as core::ops::drop::Drop>::drop <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 1.91k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 1.91k | if self.spilled() { | 2171 | 114 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 114 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 1.80k | } else { | 2174 | 1.80k | ptr::drop_in_place(&mut self[..]); | 2175 | 1.80k | } | 2176 | | } | 2177 | 1.91k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 28]> as core::ops::drop::Drop>::drop <smallvec::SmallVec<[u8; 23]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 76.3k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 76.3k | if self.spilled() { | 2171 | 3.95k | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 3.95k | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 72.3k | } else { | 2174 | 72.3k | ptr::drop_in_place(&mut self[..]); | 2175 | 72.3k | } | 2176 | | } | 2177 | 76.3k | } |
<smallvec::SmallVec<[u8; 23]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 129k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 129k | if self.spilled() { | 2171 | 1.84k | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 1.84k | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 127k | } else { | 2174 | 127k | ptr::drop_in_place(&mut self[..]); | 2175 | 127k | } | 2176 | | } | 2177 | 129k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_hash::object_id::ObjectId; 1]> 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; 28]> as core::ops::drop::Drop>::drop <smallvec::SmallVec<[&bstr::bstr::BStr; 1]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 277 | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 277 | if self.spilled() { | 2171 | 7 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 7 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 270 | } else { | 2174 | 270 | ptr::drop_in_place(&mut self[..]); | 2175 | 270 | } | 2176 | | } | 2177 | 277 | } |
<smallvec::SmallVec<[u8; 256]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 470 | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 470 | if self.spilled() { | 2171 | 219 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 219 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 251 | } else { | 2174 | 251 | ptr::drop_in_place(&mut self[..]); | 2175 | 251 | } | 2176 | | } | 2177 | 470 | } |
<smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 3.74k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 3.74k | if self.spilled() { | 2171 | 179 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 179 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 3.56k | } else { | 2174 | 3.56k | ptr::drop_in_place(&mut self[..]); | 2175 | 3.56k | } | 2176 | | } | 2177 | 3.74k | } |
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 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; 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 | 2168 | 48.2k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 48.2k | if self.spilled() { | 2171 | 1.89k | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 1.89k | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 46.3k | } else { | 2174 | 46.3k | ptr::drop_in_place(&mut self[..]); | 2175 | 46.3k | } | 2176 | | } | 2177 | 48.2k | } |
<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 | 2168 | 6.92k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 6.92k | if self.spilled() { | 2171 | 0 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 0 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 6.92k | } else { | 2174 | 6.92k | ptr::drop_in_place(&mut self[..]); | 2175 | 6.92k | } | 2176 | | } | 2177 | 6.92k | } |
<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 | 2168 | 6.92k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 6.92k | if self.spilled() { | 2171 | 397 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 397 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 6.52k | } else { | 2174 | 6.52k | ptr::drop_in_place(&mut self[..]); | 2175 | 6.52k | } | 2176 | | } | 2177 | 6.92k | } |
<smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::ops::drop::Drop>::drop Line | Count | Source | 2168 | 1.56k | fn drop(&mut self) { | 2169 | | unsafe { | 2170 | 1.56k | if self.spilled() { | 2171 | 82 | let (ptr, &mut len) = self.data.heap_mut(); | 2172 | 82 | drop(Vec::from_raw_parts(ptr.as_ptr(), len, self.capacity)); | 2173 | 1.48k | } else { | 2174 | 1.48k | ptr::drop_in_place(&mut self[..]); | 2175 | 1.48k | } | 2176 | | } | 2177 | 1.56k | } |
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_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; 28]> 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 |
2178 | | } |
2179 | | |
2180 | | impl<A: Array> Clone for SmallVec<A> |
2181 | | where |
2182 | | A::Item: Clone, |
2183 | | { |
2184 | | #[inline] |
2185 | 44.2k | fn clone(&self) -> SmallVec<A> { |
2186 | 44.2k | SmallVec::from(self.as_slice()) |
2187 | 44.2k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::clone::Clone>::clone Line | Count | Source | 2185 | 6.18k | fn clone(&self) -> SmallVec<A> { | 2186 | 6.18k | SmallVec::from(self.as_slice()) | 2187 | 6.18k | } |
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 <smallvec::SmallVec<[u8; 23]> as core::clone::Clone>::clone Line | Count | Source | 2185 | 25.4k | fn clone(&self) -> SmallVec<A> { | 2186 | 25.4k | SmallVec::from(self.as_slice()) | 2187 | 25.4k | } |
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 | 2185 | 12.6k | fn clone(&self) -> SmallVec<A> { | 2186 | 12.6k | SmallVec::from(self.as_slice()) | 2187 | 12.6k | } |
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 |
2188 | | |
2189 | 1.93k | fn clone_from(&mut self, source: &Self) { |
2190 | | // Inspired from `impl Clone for Vec`. |
2191 | | |
2192 | | // drop anything that will not be overwritten |
2193 | 1.93k | self.truncate(source.len()); |
2194 | | |
2195 | | // self.len <= other.len due to the truncate above, so the |
2196 | | // slices here are always in-bounds. |
2197 | 1.93k | let (init, tail) = source.split_at(self.len()); |
2198 | | |
2199 | | // reuse the contained values' allocations/resources. |
2200 | 1.93k | self.clone_from_slice(init); |
2201 | 1.93k | self.extend(tail.iter().cloned()); |
2202 | 1.93k | } 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 | 2189 | 1.93k | fn clone_from(&mut self, source: &Self) { | 2190 | | // Inspired from `impl Clone for Vec`. | 2191 | | | 2192 | | // drop anything that will not be overwritten | 2193 | 1.93k | self.truncate(source.len()); | 2194 | | | 2195 | | // self.len <= other.len due to the truncate above, so the | 2196 | | // slices here are always in-bounds. | 2197 | 1.93k | let (init, tail) = source.split_at(self.len()); | 2198 | | | 2199 | | // reuse the contained values' allocations/resources. | 2200 | 1.93k | self.clone_from_slice(init); | 2201 | 1.93k | self.extend(tail.iter().cloned()); | 2202 | 1.93k | } |
Unexecuted instantiation: <smallvec::SmallVec<[gix_attributes::search::TrackedAssignment; 3]> as core::clone::Clone>::clone_from |
2203 | | } |
2204 | | |
2205 | | impl<A: Array, B: Array> PartialEq<SmallVec<B>> for SmallVec<A> |
2206 | | where |
2207 | | A::Item: PartialEq<B::Item>, |
2208 | | { |
2209 | | #[inline] |
2210 | 99.1k | fn eq(&self, other: &SmallVec<B>) -> bool { |
2211 | 99.1k | self[..] == other[..] |
2212 | 99.1k | } <smallvec::SmallVec<[u8; 23]> as core::cmp::PartialEq>::eq Line | Count | Source | 2210 | 99.1k | fn eq(&self, other: &SmallVec<B>) -> bool { | 2211 | 99.1k | self[..] == other[..] | 2212 | 99.1k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::cmp::PartialEq>::eq |
2213 | | } |
2214 | | |
2215 | | impl<A: Array> Eq for SmallVec<A> where A::Item: Eq {} |
2216 | | |
2217 | | impl<A: Array> PartialOrd for SmallVec<A> |
2218 | | where |
2219 | | A::Item: PartialOrd, |
2220 | | { |
2221 | | #[inline] |
2222 | | fn partial_cmp(&self, other: &SmallVec<A>) -> Option<cmp::Ordering> { |
2223 | | PartialOrd::partial_cmp(&**self, &**other) |
2224 | | } |
2225 | | } |
2226 | | |
2227 | | impl<A: Array> Ord for SmallVec<A> |
2228 | | where |
2229 | | A::Item: Ord, |
2230 | | { |
2231 | | #[inline] |
2232 | 245k | fn cmp(&self, other: &SmallVec<A>) -> cmp::Ordering { |
2233 | 245k | Ord::cmp(&**self, &**other) |
2234 | 245k | } <smallvec::SmallVec<[u8; 23]> as core::cmp::Ord>::cmp Line | Count | Source | 2232 | 9.25k | fn cmp(&self, other: &SmallVec<A>) -> cmp::Ordering { | 2233 | 9.25k | Ord::cmp(&**self, &**other) | 2234 | 9.25k | } |
<smallvec::SmallVec<[u8; 23]> as core::cmp::Ord>::cmp Line | Count | Source | 2232 | 236k | fn cmp(&self, other: &SmallVec<A>) -> cmp::Ordering { | 2233 | 236k | Ord::cmp(&**self, &**other) | 2234 | 236k | } |
Unexecuted instantiation: <smallvec::SmallVec<[u8; 23]> as core::cmp::Ord>::cmp |
2235 | | } |
2236 | | |
2237 | | impl<A: Array> Hash for SmallVec<A> |
2238 | | where |
2239 | | A::Item: Hash, |
2240 | | { |
2241 | | fn hash<H: Hasher>(&self, state: &mut H) { |
2242 | | (**self).hash(state) |
2243 | | } |
2244 | | } |
2245 | | |
2246 | | unsafe impl<A: Array> Send for SmallVec<A> where A::Item: Send {} |
2247 | | |
2248 | | /// An iterator that consumes a `SmallVec` and yields its items by value. |
2249 | | /// |
2250 | | /// Returned from [`SmallVec::into_iter`][1]. |
2251 | | /// |
2252 | | /// [1]: struct.SmallVec.html#method.into_iter |
2253 | | pub struct IntoIter<A: Array> { |
2254 | | data: SmallVec<A>, |
2255 | | current: usize, |
2256 | | end: usize, |
2257 | | } |
2258 | | |
2259 | | impl<A: Array> fmt::Debug for IntoIter<A> |
2260 | | where |
2261 | | A::Item: fmt::Debug, |
2262 | | { |
2263 | | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
2264 | | f.debug_tuple("IntoIter").field(&self.as_slice()).finish() |
2265 | | } |
2266 | | } |
2267 | | |
2268 | | impl<A: Array + Clone> Clone for IntoIter<A> |
2269 | | where |
2270 | | A::Item: Clone, |
2271 | | { |
2272 | | fn clone(&self) -> IntoIter<A> { |
2273 | | SmallVec::from(self.as_slice()).into_iter() |
2274 | | } |
2275 | | } |
2276 | | |
2277 | | impl<A: Array> Drop for IntoIter<A> { |
2278 | 1.61k | fn drop(&mut self) { |
2279 | 1.61k | for _ in self {} |
2280 | 1.61k | } <smallvec::IntoIter<[gix_config::parse::Event; 8]> as core::ops::drop::Drop>::drop Line | Count | Source | 2278 | 1.53k | fn drop(&mut self) { | 2279 | 1.53k | for _ in self {} | 2280 | 1.53k | } |
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_pack::data::file::decode::entry::Delta; 10]> as core::ops::drop::Drop>::drop <smallvec::IntoIter<[gix_pack::data::file::decode::entry::Delta; 10]> as core::ops::drop::Drop>::drop Line | Count | Source | 2278 | 72 | fn drop(&mut self) { | 2279 | 72 | for _ in self {} | 2280 | 72 | } |
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 |
2281 | | } |
2282 | | |
2283 | | impl<A: Array> Iterator for IntoIter<A> { |
2284 | | type Item = A::Item; |
2285 | | |
2286 | | #[inline] |
2287 | 9.14M | fn next(&mut self) -> Option<A::Item> { |
2288 | 9.14M | if self.current == self.end { |
2289 | 3.15k | None |
2290 | | } else { |
2291 | | unsafe { |
2292 | 9.14M | let current = self.current; |
2293 | 9.14M | self.current += 1; |
2294 | 9.14M | Some(ptr::read(self.data.as_ptr().add(current))) |
2295 | | } |
2296 | | } |
2297 | 9.14M | } <smallvec::IntoIter<[gix_config::parse::Event; 8]> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 2287 | 9.14M | fn next(&mut self) -> Option<A::Item> { | 2288 | 9.14M | if self.current == self.end { | 2289 | 3.07k | None | 2290 | | } else { | 2291 | | unsafe { | 2292 | 9.14M | let current = self.current; | 2293 | 9.14M | self.current += 1; | 2294 | 9.14M | Some(ptr::read(self.data.as_ptr().add(current))) | 2295 | | } | 2296 | | } | 2297 | 9.14M | } |
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_pack::data::file::decode::entry::Delta; 10]> as core::iter::traits::iterator::Iterator>::next <smallvec::IntoIter<[gix_pack::data::file::decode::entry::Delta; 10]> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 2287 | 72 | fn next(&mut self) -> Option<A::Item> { | 2288 | 72 | if self.current == self.end { | 2289 | 72 | None | 2290 | | } else { | 2291 | | unsafe { | 2292 | 0 | let current = self.current; | 2293 | 0 | self.current += 1; | 2294 | 0 | Some(ptr::read(self.data.as_ptr().add(current))) | 2295 | | } | 2296 | | } | 2297 | 72 | } |
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 |
2298 | | |
2299 | | #[inline] |
2300 | 1.53k | fn size_hint(&self) -> (usize, Option<usize>) { |
2301 | 1.53k | let size = self.end - self.current; |
2302 | 1.53k | (size, Some(size)) |
2303 | 1.53k | } |
2304 | | } |
2305 | | |
2306 | | impl<A: Array> DoubleEndedIterator for IntoIter<A> { |
2307 | | #[inline] |
2308 | 234 | fn next_back(&mut self) -> Option<A::Item> { |
2309 | 234 | if self.current == self.end { |
2310 | 72 | None |
2311 | | } else { |
2312 | | unsafe { |
2313 | 162 | self.end -= 1; |
2314 | 162 | Some(ptr::read(self.data.as_ptr().add(self.end))) |
2315 | | } |
2316 | | } |
2317 | 234 | } Unexecuted instantiation: <smallvec::IntoIter<[gix_pack::data::file::decode::entry::Delta; 10]> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back <smallvec::IntoIter<[gix_pack::data::file::decode::entry::Delta; 10]> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 2308 | 234 | fn next_back(&mut self) -> Option<A::Item> { | 2309 | 234 | if self.current == self.end { | 2310 | 72 | None | 2311 | | } else { | 2312 | | unsafe { | 2313 | 162 | self.end -= 1; | 2314 | 162 | Some(ptr::read(self.data.as_ptr().add(self.end))) | 2315 | | } | 2316 | | } | 2317 | 234 | } |
|
2318 | | } |
2319 | | |
2320 | | impl<A: Array> ExactSizeIterator for IntoIter<A> {} |
2321 | | impl<A: Array> FusedIterator for IntoIter<A> {} |
2322 | | |
2323 | | impl<A: Array> IntoIter<A> { |
2324 | | /// Returns the remaining items of this iterator as a slice. |
2325 | | pub fn as_slice(&self) -> &[A::Item] { |
2326 | | let len = self.end - self.current; |
2327 | | unsafe { core::slice::from_raw_parts(self.data.as_ptr().add(self.current), len) } |
2328 | | } |
2329 | | |
2330 | | /// Returns the remaining items of this iterator as a mutable slice. |
2331 | | pub fn as_mut_slice(&mut self) -> &mut [A::Item] { |
2332 | | let len = self.end - self.current; |
2333 | | unsafe { core::slice::from_raw_parts_mut(self.data.as_mut_ptr().add(self.current), len) } |
2334 | | } |
2335 | | } |
2336 | | |
2337 | | impl<A: Array> IntoIterator for SmallVec<A> { |
2338 | | type IntoIter = IntoIter<A>; |
2339 | | type Item = A::Item; |
2340 | 1.61k | fn into_iter(mut self) -> Self::IntoIter { |
2341 | | unsafe { |
2342 | | // Set SmallVec len to zero as `IntoIter` drop handles dropping of the elements |
2343 | 1.61k | let len = self.len(); |
2344 | 1.61k | self.set_len(0); |
2345 | 1.61k | IntoIter { |
2346 | 1.61k | data: self, |
2347 | 1.61k | current: 0, |
2348 | 1.61k | end: len, |
2349 | 1.61k | } |
2350 | | } |
2351 | 1.61k | } <smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 2340 | 1.53k | fn into_iter(mut self) -> Self::IntoIter { | 2341 | | unsafe { | 2342 | | // Set SmallVec len to zero as `IntoIter` drop handles dropping of the elements | 2343 | 1.53k | let len = self.len(); | 2344 | 1.53k | self.set_len(0); | 2345 | 1.53k | IntoIter { | 2346 | 1.53k | data: self, | 2347 | 1.53k | current: 0, | 2348 | 1.53k | end: len, | 2349 | 1.53k | } | 2350 | | } | 2351 | 1.53k | } |
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_pack::data::file::decode::entry::Delta; 10]> as core::iter::traits::collect::IntoIterator>::into_iter <smallvec::SmallVec<[gix_pack::data::file::decode::entry::Delta; 10]> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 2340 | 72 | fn into_iter(mut self) -> Self::IntoIter { | 2341 | | unsafe { | 2342 | | // Set SmallVec len to zero as `IntoIter` drop handles dropping of the elements | 2343 | 72 | let len = self.len(); | 2344 | 72 | self.set_len(0); | 2345 | 72 | IntoIter { | 2346 | 72 | data: self, | 2347 | 72 | current: 0, | 2348 | 72 | end: len, | 2349 | 72 | } | 2350 | | } | 2351 | 72 | } |
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 |
2352 | | } |
2353 | | |
2354 | | impl<'a, A: Array> IntoIterator for &'a SmallVec<A> { |
2355 | | type IntoIter = slice::Iter<'a, A::Item>; |
2356 | | type Item = &'a A::Item; |
2357 | 685 | fn into_iter(self) -> Self::IntoIter { |
2358 | 685 | self.iter() |
2359 | 685 | } <&smallvec::SmallVec<[gix_config::parse::Event; 8]> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 2357 | 685 | fn into_iter(self) -> Self::IntoIter { | 2358 | 685 | self.iter() | 2359 | 685 | } |
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 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 |
2360 | | } |
2361 | | |
2362 | | impl<'a, A: Array> IntoIterator for &'a mut SmallVec<A> { |
2363 | | type IntoIter = slice::IterMut<'a, A::Item>; |
2364 | | type Item = &'a mut A::Item; |
2365 | | fn into_iter(self) -> Self::IntoIter { |
2366 | | self.iter_mut() |
2367 | | } |
2368 | | } |
2369 | | |
2370 | | /// Types that can be used as the backing store for a [`SmallVec`]. |
2371 | | pub unsafe trait Array { |
2372 | | /// The type of the array's elements. |
2373 | | type Item; |
2374 | | /// Returns the number of items the array can hold. |
2375 | | fn size() -> usize; |
2376 | | } |
2377 | | |
2378 | | /// Set the length of the vec when the `SetLenOnDrop` value goes out of scope. |
2379 | | /// |
2380 | | /// Copied from <https://github.com/rust-lang/rust/pull/36355> |
2381 | | struct SetLenOnDrop<'a> { |
2382 | | len: &'a mut usize, |
2383 | | local_len: usize, |
2384 | | } |
2385 | | |
2386 | | impl<'a> SetLenOnDrop<'a> { |
2387 | | #[inline] |
2388 | 313k | fn new(len: &'a mut usize) -> Self { |
2389 | 313k | SetLenOnDrop { |
2390 | 313k | local_len: *len, |
2391 | 313k | len, |
2392 | 313k | } |
2393 | 313k | } <smallvec::SetLenOnDrop>::new Line | Count | Source | 2388 | 280k | fn new(len: &'a mut usize) -> Self { | 2389 | 280k | SetLenOnDrop { | 2390 | 280k | local_len: *len, | 2391 | 280k | len, | 2392 | 280k | } | 2393 | 280k | } |
<smallvec::SetLenOnDrop>::new Line | Count | Source | 2388 | 32.5k | fn new(len: &'a mut usize) -> Self { | 2389 | 32.5k | SetLenOnDrop { | 2390 | 32.5k | local_len: *len, | 2391 | 32.5k | len, | 2392 | 32.5k | } | 2393 | 32.5k | } |
|
2394 | | |
2395 | | #[inline] |
2396 | 104M | fn get(&self) -> usize { |
2397 | 104M | self.local_len |
2398 | 104M | } <smallvec::SetLenOnDrop>::get Line | Count | Source | 2396 | 104M | fn get(&self) -> usize { | 2397 | 104M | self.local_len | 2398 | 104M | } |
<smallvec::SetLenOnDrop>::get Line | Count | Source | 2396 | 91.9k | fn get(&self) -> usize { | 2397 | 91.9k | self.local_len | 2398 | 91.9k | } |
|
2399 | | |
2400 | | #[inline] |
2401 | 52.0M | fn increment_len(&mut self, increment: usize) { |
2402 | 52.0M | self.local_len += increment; |
2403 | 52.0M | } <smallvec::SetLenOnDrop>::increment_len Line | Count | Source | 2401 | 52.0M | fn increment_len(&mut self, increment: usize) { | 2402 | 52.0M | self.local_len += increment; | 2403 | 52.0M | } |
<smallvec::SetLenOnDrop>::increment_len Line | Count | Source | 2401 | 29.7k | fn increment_len(&mut self, increment: usize) { | 2402 | 29.7k | self.local_len += increment; | 2403 | 29.7k | } |
|
2404 | | } |
2405 | | |
2406 | | impl<'a> Drop for SetLenOnDrop<'a> { |
2407 | | #[inline] |
2408 | 313k | fn drop(&mut self) { |
2409 | 313k | *self.len = self.local_len; |
2410 | 313k | } <smallvec::SetLenOnDrop as core::ops::drop::Drop>::drop Line | Count | Source | 2408 | 280k | fn drop(&mut self) { | 2409 | 280k | *self.len = self.local_len; | 2410 | 280k | } |
<smallvec::SetLenOnDrop as core::ops::drop::Drop>::drop Line | Count | Source | 2408 | 32.5k | fn drop(&mut self) { | 2409 | 32.5k | *self.len = self.local_len; | 2410 | 32.5k | } |
|
2411 | | } |
2412 | | |
2413 | | #[cfg(feature = "const_new")] |
2414 | | impl<T, const N: usize> SmallVec<[T; N]> { |
2415 | | /// Construct an empty vector. |
2416 | | /// |
2417 | | /// 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. |
2418 | | #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))] |
2419 | | #[inline] |
2420 | | pub const fn new_const() -> Self { |
2421 | | SmallVec { |
2422 | | capacity: 0, |
2423 | | data: SmallVecData::from_const(MaybeUninit::uninit()), |
2424 | | } |
2425 | | } |
2426 | | |
2427 | | /// The array passed as an argument is moved to be an inline version of `SmallVec`. |
2428 | | /// |
2429 | | /// 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. |
2430 | | #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))] |
2431 | | #[inline] |
2432 | | pub const fn from_const(items: [T; N]) -> Self { |
2433 | | SmallVec { |
2434 | | capacity: N, |
2435 | | data: SmallVecData::from_const(MaybeUninit::new(items)), |
2436 | | } |
2437 | | } |
2438 | | |
2439 | | /// Constructs a new `SmallVec` on the stack from an array without |
2440 | | /// copying elements. Also sets the length. The user is responsible |
2441 | | /// for ensuring that `len <= N`. |
2442 | | /// |
2443 | | /// 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. |
2444 | | #[cfg_attr(docsrs, doc(cfg(feature = "const_new")))] |
2445 | | #[inline] |
2446 | | pub const unsafe fn from_const_with_len_unchecked(items: [T; N], len: usize) -> Self { |
2447 | | SmallVec { |
2448 | | capacity: len, |
2449 | | data: SmallVecData::from_const(MaybeUninit::new(items)), |
2450 | | } |
2451 | | } |
2452 | | } |
2453 | | |
2454 | | #[cfg(feature = "const_generics")] |
2455 | | #[cfg_attr(docsrs, doc(cfg(feature = "const_generics")))] |
2456 | | unsafe impl<T, const N: usize> Array for [T; N] { |
2457 | | type Item = T; |
2458 | | #[inline] |
2459 | | fn size() -> usize { |
2460 | | N |
2461 | | } |
2462 | | } |
2463 | | |
2464 | | #[cfg(not(feature = "const_generics"))] |
2465 | | macro_rules! impl_array( |
2466 | | ($($size:expr),+) => { |
2467 | | $( |
2468 | | unsafe impl<T> Array for [T; $size] { |
2469 | | type Item = T; |
2470 | | #[inline] |
2471 | 14.7M | fn size() -> usize { $size }<[gix_config::parse::Event; 8] as smallvec::Array>::size Line | Count | Source | 2471 | 129k | fn size() -> usize { $size } |
<[u8; 2] as smallvec::Array>::size Line | Count | Source | 2471 | 126k | fn size() -> usize { $size } |
<[gix_config::parse::Event; 8] as smallvec::Array>::size Line | Count | Source | 2471 | 9.54M | fn size() -> usize { $size } |
<[u8; 2] as smallvec::Array>::size Line | Count | Source | 2471 | 395k | fn size() -> usize { $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: <[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 Unexecuted instantiation: <[gix_pack::data::file::decode::entry::Delta; 10] 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: <[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 <[gix_config::parse::Event; 8] as smallvec::Array>::size Line | Count | Source | 2471 | 19.2k | fn size() -> usize { $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 | 2471 | 18.9k | fn size() -> usize { $size } |
<[u8; 23] as smallvec::Array>::size Line | Count | Source | 2471 | 489k | fn size() -> usize { $size } |
<[u8; 23] as smallvec::Array>::size Line | Count | Source | 2471 | 2.62M | fn size() -> usize { $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: <[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 <[&bstr::bstr::BStr; 1] as smallvec::Array>::size Line | Count | Source | 2471 | 817 | fn size() -> usize { $size } |
<[u8; 256] as smallvec::Array>::size Line | Count | Source | 2471 | 9.02k | fn size() -> usize { $size } |
<[gix_pack::data::file::decode::entry::Delta; 10] as smallvec::Array>::size Line | Count | Source | 2471 | 763k | fn size() -> usize { $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 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; 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 | 2471 | 26.8k | fn size() -> usize { $size } |
<[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size Line | Count | Source | 2471 | 141k | 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 | 2471 | 27.6k | 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 | 2471 | 56.0k | fn size() -> usize { $size } |
<[gix_attributes::search::TrackedAssignment; 3] as smallvec::Array>::size Line | Count | Source | 2471 | 370k | 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 | 2471 | 45.3k | 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: <[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 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 |
2472 | | } |
2473 | | )+ |
2474 | | } |
2475 | | ); |
2476 | | |
2477 | | #[cfg(not(feature = "const_generics"))] |
2478 | | impl_array!( |
2479 | | 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, |
2480 | | 26, 27, 28, 29, 30, 31, 32, 36, 0x40, 0x60, 0x80, 0x100, 0x200, 0x400, 0x600, 0x800, 0x1000, |
2481 | | 0x2000, 0x4000, 0x6000, 0x8000, 0x10000, 0x20000, 0x40000, 0x60000, 0x80000, 0x10_0000 |
2482 | | ); |
2483 | | |
2484 | | /// Convenience trait for constructing a `SmallVec` |
2485 | | pub trait ToSmallVec<A: Array> { |
2486 | | /// Construct a new `SmallVec` from a slice. |
2487 | | fn to_smallvec(&self) -> SmallVec<A>; |
2488 | | } |
2489 | | |
2490 | | impl<A: Array> ToSmallVec<A> for [A::Item] |
2491 | | where |
2492 | | A::Item: Copy, |
2493 | | { |
2494 | | #[inline] |
2495 | | fn to_smallvec(&self) -> SmallVec<A> { |
2496 | | SmallVec::from_slice(self) |
2497 | | } |
2498 | | } |
2499 | | |
2500 | | // Immutable counterpart for `NonNull<T>`. |
2501 | | #[repr(transparent)] |
2502 | | struct ConstNonNull<T>(NonNull<T>); |
2503 | | |
2504 | | impl<T> ConstNonNull<T> { |
2505 | | #[inline] |
2506 | 968k | fn new(ptr: *const T) -> Option<Self> { |
2507 | 968k | NonNull::new(ptr as *mut T).map(Self) |
2508 | 968k | } <smallvec::ConstNonNull<gix_config::parse::Event>>::new Line | Count | Source | 2506 | 5.82k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 5.82k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 5.82k | } |
<smallvec::ConstNonNull<gix_config::parse::Event>>::new Line | Count | Source | 2506 | 83.7k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 83.7k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 83.7k | } |
<smallvec::ConstNonNull<u8>>::new Line | Count | Source | 2506 | 67.7k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 67.7k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 67.7k | } |
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<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_pack::data::file::decode::entry::Delta>>::new Unexecuted instantiation: <smallvec::ConstNonNull<(gix_hash::object_id::ObjectId, i64)>>::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_hash::object_id::ObjectId>>::new <smallvec::ConstNonNull<&bstr::bstr::BStr>>::new Line | Count | Source | 2506 | 363 | fn new(ptr: *const T) -> Option<Self> { | 2507 | 363 | NonNull::new(ptr as *mut T).map(Self) | 2508 | 363 | } |
Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::new <smallvec::ConstNonNull<u8>>::new Line | Count | Source | 2506 | 67.1k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 67.1k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 67.1k | } |
<smallvec::ConstNonNull<u8>>::new Line | Count | Source | 2506 | 656k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 656k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 656k | } |
Unexecuted instantiation: <smallvec::ConstNonNull<(gix_hash::object_id::ObjectId, i64)>>::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 <smallvec::ConstNonNull<u8>>::new Line | Count | Source | 2506 | 1.00k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 1.00k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 1.00k | } |
<smallvec::ConstNonNull<gix_pack::data::file::decode::entry::Delta>>::new Line | Count | Source | 2506 | 4.94k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 4.94k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 4.94k | } |
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<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 | 2506 | 61.8k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 61.8k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 61.8k | } |
<smallvec::ConstNonNull<(kstring::string::KStringBase<alloc::boxed::Box<str>>, core::option::Option<gix_attributes::search::AttributeId>)>>::new Line | Count | Source | 2506 | 18.1k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 18.1k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 18.1k | } |
<smallvec::ConstNonNull<(gix_attributes::search::AttributeId, gix_attributes::Assignment, core::option::Option<gix_attributes::search::AttributeId>)>>::new Line | Count | Source | 2506 | 1.19k | fn new(ptr: *const T) -> Option<Self> { | 2507 | 1.19k | NonNull::new(ptr as *mut T).map(Self) | 2508 | 1.19k | } |
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_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 |
2509 | | #[inline] |
2510 | 10.0M | fn as_ptr(self) -> *const T { |
2511 | 10.0M | self.0.as_ptr() |
2512 | 10.0M | } <smallvec::ConstNonNull<gix_config::parse::Event>>::as_ptr Line | Count | Source | 2510 | 6.18k | fn as_ptr(self) -> *const T { | 2511 | 6.18k | self.0.as_ptr() | 2512 | 6.18k | } |
<smallvec::ConstNonNull<gix_config::parse::Event>>::as_ptr Line | Count | Source | 2510 | 9.21M | fn as_ptr(self) -> *const T { | 2511 | 9.21M | self.0.as_ptr() | 2512 | 9.21M | } |
<smallvec::ConstNonNull<u8>>::as_ptr Line | Count | Source | 2510 | 67.7k | fn as_ptr(self) -> *const T { | 2511 | 67.7k | self.0.as_ptr() | 2512 | 67.7k | } |
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<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_pack::data::file::decode::entry::Delta>>::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_hash::object_id::ObjectId>>::as_ptr Unexecuted instantiation: <smallvec::ConstNonNull<&bstr::bstr::BStr>>::as_ptr Unexecuted instantiation: <smallvec::ConstNonNull<u8>>::as_ptr <smallvec::ConstNonNull<u8>>::as_ptr Line | Count | Source | 2510 | 69.7k | fn as_ptr(self) -> *const T { | 2511 | 69.7k | self.0.as_ptr() | 2512 | 69.7k | } |
<smallvec::ConstNonNull<u8>>::as_ptr Line | Count | Source | 2510 | 671k | fn as_ptr(self) -> *const T { | 2511 | 671k | self.0.as_ptr() | 2512 | 671k | } |
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 <smallvec::ConstNonNull<u8>>::as_ptr Line | Count | Source | 2510 | 940 | fn as_ptr(self) -> *const T { | 2511 | 940 | self.0.as_ptr() | 2512 | 940 | } |
<smallvec::ConstNonNull<gix_pack::data::file::decode::entry::Delta>>::as_ptr Line | Count | Source | 2510 | 162 | fn as_ptr(self) -> *const T { | 2511 | 162 | self.0.as_ptr() | 2512 | 162 | } |
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<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 | 2510 | 29.3k | fn as_ptr(self) -> *const T { | 2511 | 29.3k | self.0.as_ptr() | 2512 | 29.3k | } |
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_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 |
2513 | | } |
2514 | | |
2515 | | impl<T> Clone for ConstNonNull<T> { |
2516 | | #[inline] |
2517 | | fn clone(&self) -> Self { |
2518 | | *self |
2519 | | } |
2520 | | } |
2521 | | |
2522 | | impl<T> Copy for ConstNonNull<T> {} |
2523 | | |
2524 | | #[cfg(feature = "impl_bincode")] |
2525 | | use bincode::{ |
2526 | | de::{BorrowDecoder, Decode, Decoder, read::Reader}, |
2527 | | enc::{Encode, Encoder, write::Writer}, |
2528 | | error::{DecodeError, EncodeError}, |
2529 | | BorrowDecode, |
2530 | | }; |
2531 | | |
2532 | | #[cfg(feature = "impl_bincode")] |
2533 | | impl<A, Context> Decode<Context> for SmallVec<A> |
2534 | | where |
2535 | | A: Array, |
2536 | | A::Item: Decode<Context>, |
2537 | | { |
2538 | | fn decode<D: Decoder<Context = Context>>(decoder: &mut D) -> Result<Self, DecodeError> { |
2539 | | use core::convert::TryInto; |
2540 | | let len = u64::decode(decoder)?; |
2541 | | let len = len.try_into().map_err(|_| DecodeError::OutsideUsizeRange(len))?; |
2542 | | decoder.claim_container_read::<A::Item>(len)?; |
2543 | | |
2544 | | let mut vec = SmallVec::with_capacity(len); |
2545 | | if unty::type_equal::<A::Item, u8>() { |
2546 | | // Initialize the smallvec's buffer. Note that we need to do this through |
2547 | | // the raw pointer as we cannot name the type [u8; N] even though A::Item is u8. |
2548 | | let ptr = vec.as_mut_ptr(); |
2549 | | // SAFETY: A::Item is u8 and the smallvec has been allocated with enough capacity |
2550 | | unsafe { |
2551 | | core::ptr::write_bytes(ptr, 0, len); |
2552 | | vec.set_len(len); |
2553 | | } |
2554 | | // Read the data into the smallvec's buffer. |
2555 | | let slice = vec.as_mut_slice(); |
2556 | | // SAFETY: A::Item is u8 |
2557 | | let slice = unsafe { core::mem::transmute::<&mut [A::Item], &mut [u8]>(slice) }; |
2558 | | decoder.reader().read(slice)?; |
2559 | | } else { |
2560 | | for _ in 0..len { |
2561 | | decoder.unclaim_bytes_read(core::mem::size_of::<A::Item>()); |
2562 | | vec.push(A::Item::decode(decoder)?); |
2563 | | } |
2564 | | } |
2565 | | Ok(vec) |
2566 | | } |
2567 | | } |
2568 | | |
2569 | | #[cfg(feature = "impl_bincode")] |
2570 | | impl<'de, A, Context> BorrowDecode<'de, Context> for SmallVec<A> |
2571 | | where |
2572 | | A: Array, |
2573 | | A::Item: BorrowDecode<'de, Context>, |
2574 | | { |
2575 | | fn borrow_decode<D: BorrowDecoder<'de, Context = Context>>(decoder: &mut D) -> Result<Self, DecodeError> { |
2576 | | use core::convert::TryInto; |
2577 | | let len = u64::decode(decoder)?; |
2578 | | let len = len.try_into().map_err(|_| DecodeError::OutsideUsizeRange(len))?; |
2579 | | decoder.claim_container_read::<A::Item>(len)?; |
2580 | | |
2581 | | let mut vec = SmallVec::with_capacity(len); |
2582 | | if unty::type_equal::<A::Item, u8>() { |
2583 | | // Initialize the smallvec's buffer. Note that we need to do this through |
2584 | | // the raw pointer as we cannot name the type [u8; N] even though A::Item is u8. |
2585 | | let ptr = vec.as_mut_ptr(); |
2586 | | // SAFETY: A::Item is u8 and the smallvec has been allocated with enough capacity |
2587 | | unsafe { |
2588 | | core::ptr::write_bytes(ptr, 0, len); |
2589 | | vec.set_len(len); |
2590 | | } |
2591 | | // Read the data into the smallvec's buffer. |
2592 | | let slice = vec.as_mut_slice(); |
2593 | | // SAFETY: A::Item is u8 |
2594 | | let slice = unsafe { core::mem::transmute::<&mut [A::Item], &mut [u8]>(slice) }; |
2595 | | decoder.reader().read(slice)?; |
2596 | | } else { |
2597 | | for _ in 0..len { |
2598 | | decoder.unclaim_bytes_read(core::mem::size_of::<A::Item>()); |
2599 | | vec.push(A::Item::borrow_decode(decoder)?); |
2600 | | } |
2601 | | } |
2602 | | Ok(vec) |
2603 | | } |
2604 | | } |
2605 | | |
2606 | | #[cfg(feature = "impl_bincode")] |
2607 | | impl<A> Encode for SmallVec<A> |
2608 | | where |
2609 | | A: Array, |
2610 | | A::Item: Encode, |
2611 | | { |
2612 | | fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError> { |
2613 | | (self.len() as u64).encode(encoder)?; |
2614 | | if unty::type_equal::<A::Item, u8>() { |
2615 | | // Safety: A::Item is u8 |
2616 | | let slice: &[u8] = unsafe { core::mem::transmute(self.as_slice()) }; |
2617 | | encoder.writer().write(slice)?; |
2618 | | } else { |
2619 | | for item in self.iter() { |
2620 | | item.encode(encoder)?; |
2621 | | } |
2622 | | } |
2623 | | Ok(()) |
2624 | | } |
2625 | | } |