/rust/registry/src/index.crates.io-1949cf8c6b5b557f/fallible_collections-0.5.1/src/vec.rs
Line | Count | Source |
1 | | //! Implement Fallible Vec |
2 | | use super::TryClone; |
3 | | use crate::TryReserveError; |
4 | | #[allow(unused_imports)] |
5 | | use alloc::alloc::{alloc, realloc, Layout}; |
6 | | use alloc::vec::Vec; |
7 | | use core::convert::TryInto as _; |
8 | | |
9 | | #[cfg(feature = "unstable")] |
10 | | #[macro_export] |
11 | | /// macro trying to create a vec, return a |
12 | | /// Result<Vec<T>,TryReserveError> |
13 | | macro_rules! try_vec { |
14 | | ($elem:expr; $n:expr) => ( |
15 | | $crate::vec::try_from_elem($elem, $n) |
16 | | ); |
17 | | ($($x:expr),*) => ( |
18 | | match <alloc::boxed::Box<_> as $crate::boxed::FallibleBox<_>>::try_new([$($x),*]) { |
19 | | Err(e) => Err(e), |
20 | | Ok(b) => Ok(<[_]>::into_vec(b)), |
21 | | } |
22 | | ); |
23 | | ($($x:expr,)*) => ($crate::try_vec![$($x),*]) |
24 | | } |
25 | | |
26 | | /// trait implementing all fallible methods on vec |
27 | | pub trait FallibleVec<T> { |
28 | | /// see reserve |
29 | | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>; |
30 | | /// see push |
31 | | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError>; |
32 | | /// try push and give back ownership in case of error |
33 | | fn try_push_give_back(&mut self, elem: T) -> Result<(), (T, TryReserveError)>; |
34 | | /// see with capacity, (Self must be sized by the constraint of Result) |
35 | | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> |
36 | | where |
37 | | Self: core::marker::Sized; |
38 | | /// see insert |
39 | | fn try_insert(&mut self, index: usize, element: T) -> Result<(), (T, TryReserveError)>; |
40 | | /// see append |
41 | | fn try_append(&mut self, other: &mut Self) -> Result<(), TryReserveError>; |
42 | | /// see resize, only works when the `value` implements Copy, otherwise, look at try_resize_no_copy |
43 | | fn try_resize(&mut self, new_len: usize, value: T) -> Result<(), TryReserveError> |
44 | | where |
45 | | T: Copy + Clone; |
46 | | fn try_resize_with<F>(&mut self, new_len: usize, f: F) -> Result<(), TryReserveError> |
47 | | where |
48 | | F: FnMut() -> T; |
49 | | /// resize the vec by trying to clone the value repeatingly |
50 | | fn try_resize_no_copy(&mut self, new_len: usize, value: T) -> Result<(), TryReserveError> |
51 | | where |
52 | | T: TryClone; |
53 | | /// see resize, only works when the `value` implements Copy, otherwise, look at try_extend_from_slice_no_copy |
54 | | fn try_extend_from_slice(&mut self, other: &[T]) -> Result<(), TryReserveError> |
55 | | where |
56 | | T: Copy + Clone; |
57 | | /// extend the vec by trying to clone the value in `other` |
58 | | fn try_extend_from_slice_no_copy(&mut self, other: &[T]) -> Result<(), TryReserveError> |
59 | | where |
60 | | T: TryClone; |
61 | | } |
62 | | |
63 | | /// TryVec is a thin wrapper around alloc::vec::Vec to provide support for |
64 | | /// fallible allocation. |
65 | | /// |
66 | | /// See the crate documentation for more. |
67 | | #[derive(PartialEq)] |
68 | | pub struct TryVec<T> { |
69 | | inner: Vec<T>, |
70 | | } |
71 | | |
72 | | impl<T> Default for TryVec<T> { |
73 | | #[inline(always)] |
74 | 29.2k | fn default() -> Self { |
75 | 29.2k | Self { |
76 | 29.2k | inner: Default::default(), |
77 | 29.2k | } |
78 | 29.2k | } <fallible_collections::vec::TryVec<u8> as core::default::Default>::default Line | Count | Source | 74 | 26.3k | fn default() -> Self { | 75 | 26.3k | Self { | 76 | 26.3k | inner: Default::default(), | 77 | 26.3k | } | 78 | 26.3k | } |
<fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry> as core::default::Default>::default Line | Count | Source | 74 | 41 | fn default() -> Self { | 75 | 41 | Self { | 76 | 41 | inner: Default::default(), | 77 | 41 | } | 78 | 41 | } |
<fallible_collections::vec::TryVec<mp4parse::ProtectionSystemSpecificHeaderBox> as core::default::Default>::default Line | Count | Source | 74 | 1.36k | fn default() -> Self { | 75 | 1.36k | Self { | 76 | 1.36k | inner: Default::default(), | 77 | 1.36k | } | 78 | 1.36k | } |
<fallible_collections::vec::TryVec<mp4parse::Track> as core::default::Default>::default Line | Count | Source | 74 | 1.36k | fn default() -> Self { | 75 | 1.36k | Self { | 76 | 1.36k | inner: Default::default(), | 77 | 1.36k | } | 78 | 1.36k | } |
<fallible_collections::vec::TryVec<mp4parse::ItemId> as core::default::Default>::default Line | Count | Source | 74 | 41 | fn default() -> Self { | 75 | 41 | Self { | 76 | 41 | inner: Default::default(), | 77 | 41 | } | 78 | 41 | } |
<fallible_collections::vec::TryVec<mp4parse::DataBox> as core::default::Default>::default Line | Count | Source | 74 | 22 | fn default() -> Self { | 75 | 22 | Self { | 76 | 22 | inner: Default::default(), | 77 | 22 | } | 78 | 22 | } |
<fallible_collections::vec::TryVec<mp4parse::ItemInfoEntry> as core::default::Default>::default Line | Count | Source | 74 | 19 | fn default() -> Self { | 75 | 19 | Self { | 76 | 19 | inner: Default::default(), | 77 | 19 | } | 78 | 19 | } |
<fallible_collections::vec::TryVec<mp4parse::SingleItemTypeReferenceBox> as core::default::Default>::default Line | Count | Source | 74 | 36 | fn default() -> Self { | 75 | 36 | Self { | 76 | 36 | inner: Default::default(), | 77 | 36 | } | 78 | 36 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_> as core::default::Default>::default |
79 | | } |
80 | | |
81 | | impl<T: core::fmt::Debug> core::fmt::Debug for TryVec<T> { |
82 | | #[inline] |
83 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
84 | 0 | self.inner.fmt(f) |
85 | 0 | } Unexecuted instantiation: <fallible_collections::vec::TryVec<fallible_collections::vec::TryVec<u8>> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::TimeOffset> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::Association> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::SampleEntry> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::SampleToChunk> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::FLACMetadataBlock> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::TrackReferenceEntry> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::ProtectionSchemeInfoBox> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::SingleItemTypeReferenceBox> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::ProtectionSystemSpecificHeaderBox> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::Edit> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::Track> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::ItemId> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::Sample> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::DataBox> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<mp4parse::boxes::FourCC> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<u32> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<u64> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<u8> as core::fmt::Debug>::fmt Unexecuted instantiation: <fallible_collections::vec::TryVec<_> as core::fmt::Debug>::fmt |
86 | | } |
87 | | |
88 | | impl<T> TryVec<T> { |
89 | | #[inline(always)] |
90 | 927k | pub fn new() -> Self { |
91 | 927k | Self { inner: Vec::new() } |
92 | 927k | } <fallible_collections::vec::TryVec<u8>>::new Line | Count | Source | 90 | 786k | pub fn new() -> Self { | 91 | 786k | Self { inner: Vec::new() } | 92 | 786k | } |
<fallible_collections::vec::TryVec<fallible_collections::vec::TryVec<u8>>>::new Line | Count | Source | 90 | 72.3k | pub fn new() -> Self { | 91 | 72.3k | Self { inner: Vec::new() } | 92 | 72.3k | } |
<fallible_collections::vec::TryVec<mp4parse::FLACMetadataBlock>>::new Line | Count | Source | 90 | 44 | pub fn new() -> Self { | 91 | 44 | Self { inner: Vec::new() } | 92 | 44 | } |
<fallible_collections::vec::TryVec<mp4parse::ProtectionSchemeInfoBox>>::new Line | Count | Source | 90 | 40.1k | pub fn new() -> Self { | 91 | 40.1k | Self { inner: Vec::new() } | 92 | 40.1k | } |
<fallible_collections::vec::TryVec<mp4parse::SingleItemTypeReferenceBox>>::new Line | Count | Source | 90 | 2 | pub fn new() -> Self { | 91 | 2 | Self { inner: Vec::new() } | 92 | 2 | } |
<fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry>>::new Line | Count | Source | 90 | 18 | pub fn new() -> Self { | 91 | 18 | Self { inner: Vec::new() } | 92 | 18 | } |
<fallible_collections::vec::TryVec<mp4parse::ItemId>>::new Line | Count | Source | 90 | 18 | pub fn new() -> Self { | 91 | 18 | Self { inner: Vec::new() } | 92 | 18 | } |
<fallible_collections::vec::TryVec<mp4parse::DataBox>>::new Line | Count | Source | 90 | 518 | pub fn new() -> Self { | 91 | 518 | Self { inner: Vec::new() } | 92 | 518 | } |
<fallible_collections::vec::TryVec<u32>>::new Line | Count | Source | 90 | 28.2k | pub fn new() -> Self { | 91 | 28.2k | Self { inner: Vec::new() } | 92 | 28.2k | } |
<fallible_collections::vec::TryVec<u8>>::new Line | Count | Source | 90 | 8 | pub fn new() -> Self { | 91 | 8 | Self { inner: Vec::new() } | 92 | 8 | } |
<fallible_collections::vec::TryVec<&mp4parse::ItemProperty>>::new Line | Count | Source | 90 | 95 | pub fn new() -> Self { | 91 | 95 | Self { inner: Vec::new() } | 92 | 95 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::new |
93 | | |
94 | | #[inline] |
95 | 158k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { |
96 | | Ok(Self { |
97 | 158k | inner: FallibleVec::try_with_capacity(capacity)?, |
98 | | }) |
99 | 158k | } <fallible_collections::vec::TryVec<mp4parse::TimeOffset>>::with_capacity Line | Count | Source | 95 | 1.38k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 1.38k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 1.38k | } |
<fallible_collections::vec::TryVec<mp4parse::Association>>::with_capacity Line | Count | Source | 95 | 19 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 19 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 19 | } |
<fallible_collections::vec::TryVec<mp4parse::SampleEntry>>::with_capacity Line | Count | Source | 95 | 32.2k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 32.2k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 32.2k | } |
<fallible_collections::vec::TryVec<mp4parse::ItemInfoEntry>>::with_capacity Line | Count | Source | 95 | 19 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 19 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 19 | } |
<fallible_collections::vec::TryVec<mp4parse::SampleToChunk>>::with_capacity Line | Count | Source | 95 | 30.6k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 30.6k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 30.6k | } |
<fallible_collections::vec::TryVec<mp4parse::TrackReferenceEntry>>::with_capacity Line | Count | Source | 95 | 2.39k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 2.39k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 2.39k | } |
<fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry>>::with_capacity Line | Count | Source | 95 | 18 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 18 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 18 | } |
<fallible_collections::vec::TryVec<mp4parse::Edit>>::with_capacity Line | Count | Source | 95 | 10.2k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 10.2k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 10.2k | } |
<fallible_collections::vec::TryVec<mp4parse::Extent>>::with_capacity Line | Count | Source | 95 | 67 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 67 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 67 | } |
<fallible_collections::vec::TryVec<mp4parse::Sample>>::with_capacity Line | Count | Source | 95 | 20.8k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 20.8k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 20.8k | } |
<fallible_collections::vec::TryVec<mp4parse_capi::Mp4parseTrackAudioSampleInfo>>::with_capacity Line | Count | Source | 95 | 15.1k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 15.1k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 15.1k | } |
<fallible_collections::vec::TryVec<mp4parse_capi::Mp4parseTrackVideoSampleInfo>>::with_capacity Line | Count | Source | 95 | 5.39k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 5.39k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 5.39k | } |
<fallible_collections::vec::TryVec<mp4parse::boxes::FourCC>>::with_capacity Line | Count | Source | 95 | 5.51k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 5.51k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 5.51k | } |
<fallible_collections::vec::TryVec<(u8, u32)>>::with_capacity Line | Count | Source | 95 | 18 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 18 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 18 | } |
<fallible_collections::vec::TryVec<u8>>::with_capacity Line | Count | Source | 95 | 224 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 224 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 224 | } |
<fallible_collections::vec::TryVec<u32>>::with_capacity Line | Count | Source | 95 | 5.40k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 5.40k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 5.40k | } |
<fallible_collections::vec::TryVec<u64>>::with_capacity Line | Count | Source | 95 | 28.5k | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 28.5k | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 28.5k | } |
<fallible_collections::vec::TryVec<mp4parse::unstable::Indice>>::with_capacity Line | Count | Source | 95 | 358 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 358 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 358 | } |
<fallible_collections::vec::TryVec<usize>>::with_capacity Line | Count | Source | 95 | 54 | pub fn with_capacity(capacity: usize) -> Result<Self, TryReserveError> { | 96 | | Ok(Self { | 97 | 54 | inner: FallibleVec::try_with_capacity(capacity)?, | 98 | | }) | 99 | 54 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::with_capacity |
100 | | |
101 | | #[inline(always)] |
102 | 4.85k | pub fn append(&mut self, other: &mut Self) -> Result<(), TryReserveError> { |
103 | 4.85k | FallibleVec::try_append(&mut self.inner, &mut other.inner) |
104 | 4.85k | } <fallible_collections::vec::TryVec<u8>>::append Line | Count | Source | 102 | 4.85k | pub fn append(&mut self, other: &mut Self) -> Result<(), TryReserveError> { | 103 | 4.85k | FallibleVec::try_append(&mut self.inner, &mut other.inner) | 104 | 4.85k | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::append |
105 | | |
106 | | #[inline(always)] |
107 | 330 | pub fn as_mut_slice(&mut self) -> &mut [T] { |
108 | 330 | self |
109 | 330 | } <fallible_collections::vec::TryVec<mp4parse::unstable::Indice>>::as_mut_slice Line | Count | Source | 107 | 330 | pub fn as_mut_slice(&mut self) -> &mut [T] { | 108 | 330 | self | 109 | 330 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::as_mut_slice |
110 | | |
111 | | #[inline(always)] |
112 | 44.1k | pub fn as_slice(&self) -> &[T] { |
113 | 44.1k | self |
114 | 44.1k | } <fallible_collections::vec::TryVec<u8>>::as_slice Line | Count | Source | 112 | 42.9k | pub fn as_slice(&self) -> &[T] { | 113 | 42.9k | self | 114 | 42.9k | } |
<fallible_collections::vec::TryVec<&mp4parse::ItemProperty>>::as_slice Line | Count | Source | 112 | 95 | pub fn as_slice(&self) -> &[T] { | 113 | 95 | self | 114 | 95 | } |
<fallible_collections::vec::TryVec<u8>>::as_slice Line | Count | Source | 112 | 12 | pub fn as_slice(&self) -> &[T] { | 113 | 12 | self | 114 | 12 | } |
<fallible_collections::vec::TryVec<mp4parse::TimeOffset>>::as_slice Line | Count | Source | 112 | 49 | pub fn as_slice(&self) -> &[T] { | 113 | 49 | self | 114 | 49 | } |
<fallible_collections::vec::TryVec<mp4parse::SampleToChunk>>::as_slice Line | Count | Source | 112 | 715 | pub fn as_slice(&self) -> &[T] { | 113 | 715 | self | 114 | 715 | } |
<fallible_collections::vec::TryVec<mp4parse::Sample>>::as_slice Line | Count | Source | 112 | 330 | pub fn as_slice(&self) -> &[T] { | 113 | 330 | self | 114 | 330 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::as_slice |
115 | | |
116 | | #[inline(always)] |
117 | 276 | pub fn clear(&mut self) { |
118 | 276 | self.inner.clear() |
119 | 276 | } <fallible_collections::vec::TryVec<u8>>::clear Line | Count | Source | 117 | 276 | pub fn clear(&mut self) { | 118 | 276 | self.inner.clear() | 119 | 276 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::clear |
120 | | |
121 | | #[cfg(test)] |
122 | | pub fn into_inner(self) -> Vec<T> { |
123 | | self.inner |
124 | | } |
125 | | |
126 | | #[inline(always)] |
127 | 44.9k | pub fn is_empty(&self) -> bool { |
128 | 44.9k | self.inner.is_empty() |
129 | 44.9k | } <fallible_collections::vec::TryVec<mp4parse::SampleEntry>>::is_empty Line | Count | Source | 127 | 20.7k | pub fn is_empty(&self) -> bool { | 128 | 20.7k | self.inner.is_empty() | 129 | 20.7k | } |
<fallible_collections::vec::TryVec<mp4parse::SampleToChunk>>::is_empty Line | Count | Source | 127 | 586 | pub fn is_empty(&self) -> bool { | 128 | 586 | self.inner.is_empty() | 129 | 586 | } |
<fallible_collections::vec::TryVec<mp4parse::Sample>>::is_empty Line | Count | Source | 127 | 101 | pub fn is_empty(&self) -> bool { | 128 | 101 | self.inner.is_empty() | 129 | 101 | } |
<fallible_collections::vec::TryVec<u64>>::is_empty Line | Count | Source | 127 | 208 | pub fn is_empty(&self) -> bool { | 128 | 208 | self.inner.is_empty() | 129 | 208 | } |
<fallible_collections::vec::TryVec<mp4parse::FLACMetadataBlock>>::is_empty Line | Count | Source | 127 | 9 | pub fn is_empty(&self) -> bool { | 128 | 9 | self.inner.is_empty() | 129 | 9 | } |
<fallible_collections::vec::TryVec<mp4parse::Edit>>::is_empty Line | Count | Source | 127 | 10.2k | pub fn is_empty(&self) -> bool { | 128 | 10.2k | self.inner.is_empty() | 129 | 10.2k | } |
<fallible_collections::vec::TryVec<u8>>::is_empty Line | Count | Source | 127 | 12.6k | pub fn is_empty(&self) -> bool { | 128 | 12.6k | self.inner.is_empty() | 129 | 12.6k | } |
<fallible_collections::vec::TryVec<mp4parse::unstable::Indice>>::is_empty Line | Count | Source | 127 | 330 | pub fn is_empty(&self) -> bool { | 128 | 330 | self.inner.is_empty() | 129 | 330 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::is_empty |
130 | | |
131 | | #[inline(always)] |
132 | 0 | pub fn iter_mut(&mut self) -> IterMut<T> { |
133 | 0 | IterMut { |
134 | 0 | inner: self.inner.iter_mut(), |
135 | 0 | } |
136 | 0 | } |
137 | | |
138 | | #[inline(always)] |
139 | 89.4k | pub fn iter(&self) -> Iter<T> { |
140 | 89.4k | Iter { |
141 | 89.4k | inner: self.inner.iter(), |
142 | 89.4k | } |
143 | 89.4k | } <fallible_collections::vec::TryVec<mp4parse::SampleEntry>>::iter Line | Count | Source | 139 | 20.5k | pub fn iter(&self) -> Iter<T> { | 140 | 20.5k | Iter { | 141 | 20.5k | inner: self.inner.iter(), | 142 | 20.5k | } | 143 | 20.5k | } |
<fallible_collections::vec::TryVec<mp4parse::ProtectionSchemeInfoBox>>::iter Line | Count | Source | 139 | 19.5k | pub fn iter(&self) -> Iter<T> { | 140 | 19.5k | Iter { | 141 | 19.5k | inner: self.inner.iter(), | 142 | 19.5k | } | 143 | 19.5k | } |
<fallible_collections::vec::TryVec<mp4parse::Track>>::iter Line | Count | Source | 139 | 48.7k | pub fn iter(&self) -> Iter<T> { | 140 | 48.7k | Iter { | 141 | 48.7k | inner: self.inner.iter(), | 142 | 48.7k | } | 143 | 48.7k | } |
<fallible_collections::vec::TryVec<mp4parse::SampleToChunk>>::iter Line | Count | Source | 139 | 11 | pub fn iter(&self) -> Iter<T> { | 140 | 11 | Iter { | 141 | 11 | inner: self.inner.iter(), | 142 | 11 | } | 143 | 11 | } |
<fallible_collections::vec::TryVec<mp4parse::ItemInfoEntry>>::iter Line | Count | Source | 139 | 16 | pub fn iter(&self) -> Iter<T> { | 140 | 16 | Iter { | 141 | 16 | inner: self.inner.iter(), | 142 | 16 | } | 143 | 16 | } |
<fallible_collections::vec::TryVec<mp4parse::SingleItemTypeReferenceBox>>::iter Line | Count | Source | 139 | 19 | pub fn iter(&self) -> Iter<T> { | 140 | 19 | Iter { | 141 | 19 | inner: self.inner.iter(), | 142 | 19 | } | 143 | 19 | } |
<fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry>>::iter Line | Count | Source | 139 | 19 | pub fn iter(&self) -> Iter<T> { | 140 | 19 | Iter { | 141 | 19 | inner: self.inner.iter(), | 142 | 19 | } | 143 | 19 | } |
<fallible_collections::vec::TryVec<mp4parse::DataBox>>::iter Line | Count | Source | 139 | 24 | pub fn iter(&self) -> Iter<T> { | 140 | 24 | Iter { | 141 | 24 | inner: self.inner.iter(), | 142 | 24 | } | 143 | 24 | } |
<fallible_collections::vec::TryVec<u8>>::iter Line | Count | Source | 139 | 138 | pub fn iter(&self) -> Iter<T> { | 140 | 138 | Iter { | 141 | 138 | inner: self.inner.iter(), | 142 | 138 | } | 143 | 138 | } |
<fallible_collections::vec::TryVec<mp4parse::TrackReferenceEntry>>::iter Line | Count | Source | 139 | 57 | pub fn iter(&self) -> Iter<T> { | 140 | 57 | Iter { | 141 | 57 | inner: self.inner.iter(), | 142 | 57 | } | 143 | 57 | } |
<fallible_collections::vec::TryVec<u32>>::iter Line | Count | Source | 139 | 358 | pub fn iter(&self) -> Iter<T> { | 140 | 358 | Iter { | 141 | 358 | inner: self.inner.iter(), | 142 | 358 | } | 143 | 358 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::iter |
144 | | |
145 | | #[inline(always)] |
146 | 46.0k | pub fn pop(&mut self) -> Option<T> { |
147 | 46.0k | self.inner.pop() |
148 | 46.0k | } <fallible_collections::vec::TryVec<fallible_collections::vec::TryVec<u8>>>::pop Line | Count | Source | 146 | 46.0k | pub fn pop(&mut self) -> Option<T> { | 147 | 46.0k | self.inner.pop() | 148 | 46.0k | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::pop |
149 | | |
150 | | #[inline(always)] |
151 | 122M | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { |
152 | 122M | FallibleVec::try_push(&mut self.inner, value) |
153 | 122M | } <fallible_collections::vec::TryVec<mp4parse_capi::Mp4parseTrackAudioSampleInfo>>::push Line | Count | Source | 151 | 13.7k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 13.7k | FallibleVec::try_push(&mut self.inner, value) | 153 | 13.7k | } |
<fallible_collections::vec::TryVec<mp4parse_capi::Mp4parseTrackVideoSampleInfo>>::push Line | Count | Source | 151 | 5.80k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 5.80k | FallibleVec::try_push(&mut self.inner, value) | 153 | 5.80k | } |
<fallible_collections::vec::TryVec<fallible_collections::vec::TryVec<u8>>>::push Line | Count | Source | 151 | 211k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 211k | FallibleVec::try_push(&mut self.inner, value) | 153 | 211k | } |
<fallible_collections::vec::TryVec<mp4parse::TimeOffset>>::push Line | Count | Source | 151 | 382k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 382k | FallibleVec::try_push(&mut self.inner, value) | 153 | 382k | } |
<fallible_collections::vec::TryVec<mp4parse::Association>>::push Line | Count | Source | 151 | 82 | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 82 | FallibleVec::try_push(&mut self.inner, value) | 153 | 82 | } |
<fallible_collections::vec::TryVec<mp4parse::SampleEntry>>::push Line | Count | Source | 151 | 133k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 133k | FallibleVec::try_push(&mut self.inner, value) | 153 | 133k | } |
<fallible_collections::vec::TryVec<mp4parse::ItemInfoEntry>>::push Line | Count | Source | 151 | 17 | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 17 | FallibleVec::try_push(&mut self.inner, value) | 153 | 17 | } |
<fallible_collections::vec::TryVec<mp4parse::SampleToChunk>>::push Line | Count | Source | 151 | 63.3k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 63.3k | FallibleVec::try_push(&mut self.inner, value) | 153 | 63.3k | } |
<fallible_collections::vec::TryVec<mp4parse::FLACMetadataBlock>>::push Line | Count | Source | 151 | 442k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 442k | FallibleVec::try_push(&mut self.inner, value) | 153 | 442k | } |
<fallible_collections::vec::TryVec<mp4parse::TrackReferenceEntry>>::push Line | Count | Source | 151 | 2.12k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 2.12k | FallibleVec::try_push(&mut self.inner, value) | 153 | 2.12k | } |
<fallible_collections::vec::TryVec<mp4parse::ProtectionSchemeInfoBox>>::push Line | Count | Source | 151 | 10.9k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 10.9k | FallibleVec::try_push(&mut self.inner, value) | 153 | 10.9k | } |
<fallible_collections::vec::TryVec<mp4parse::SingleItemTypeReferenceBox>>::push Line | Count | Source | 151 | 21.8k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 21.8k | FallibleVec::try_push(&mut self.inner, value) | 153 | 21.8k | } |
<fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry>>::push Line | Count | Source | 151 | 38 | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 38 | FallibleVec::try_push(&mut self.inner, value) | 153 | 38 | } |
<fallible_collections::vec::TryVec<mp4parse::ProtectionSystemSpecificHeaderBox>>::push Line | Count | Source | 151 | 4.85k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 4.85k | FallibleVec::try_push(&mut self.inner, value) | 153 | 4.85k | } |
<fallible_collections::vec::TryVec<mp4parse::Edit>>::push Line | Count | Source | 151 | 208k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 208k | FallibleVec::try_push(&mut self.inner, value) | 153 | 208k | } |
<fallible_collections::vec::TryVec<mp4parse::Track>>::push Line | Count | Source | 151 | 48.8k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 48.8k | FallibleVec::try_push(&mut self.inner, value) | 153 | 48.8k | } |
<fallible_collections::vec::TryVec<mp4parse::Extent>>::push Line | Count | Source | 151 | 1.03M | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 1.03M | FallibleVec::try_push(&mut self.inner, value) | 153 | 1.03M | } |
<fallible_collections::vec::TryVec<mp4parse::ItemId>>::push Line | Count | Source | 151 | 9 | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 9 | FallibleVec::try_push(&mut self.inner, value) | 153 | 9 | } |
<fallible_collections::vec::TryVec<mp4parse::Sample>>::push Line | Count | Source | 151 | 28.3k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 28.3k | FallibleVec::try_push(&mut self.inner, value) | 153 | 28.3k | } |
<fallible_collections::vec::TryVec<mp4parse::DataBox>>::push Line | Count | Source | 151 | 22.7k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 22.7k | FallibleVec::try_push(&mut self.inner, value) | 153 | 22.7k | } |
<fallible_collections::vec::TryVec<mp4parse::boxes::FourCC>>::push Line | Count | Source | 151 | 279k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 279k | FallibleVec::try_push(&mut self.inner, value) | 153 | 279k | } |
<fallible_collections::vec::TryVec<(u8, u32)>>::push Line | Count | Source | 151 | 18 | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 18 | FallibleVec::try_push(&mut self.inner, value) | 153 | 18 | } |
<fallible_collections::vec::TryVec<u32>>::push Line | Count | Source | 151 | 217k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 217k | FallibleVec::try_push(&mut self.inner, value) | 153 | 217k | } |
<fallible_collections::vec::TryVec<u64>>::push Line | Count | Source | 151 | 415k | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 415k | FallibleVec::try_push(&mut self.inner, value) | 153 | 415k | } |
<fallible_collections::vec::TryVec<&mp4parse::ItemProperty>>::push Line | Count | Source | 151 | 57 | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 57 | FallibleVec::try_push(&mut self.inner, value) | 153 | 57 | } |
<fallible_collections::vec::TryVec<mp4parse::unstable::Indice>>::push Line | Count | Source | 151 | 59.3M | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 59.3M | FallibleVec::try_push(&mut self.inner, value) | 153 | 59.3M | } |
<fallible_collections::vec::TryVec<usize>>::push Line | Count | Source | 151 | 59.3M | pub fn push(&mut self, value: T) -> Result<(), TryReserveError> { | 152 | 59.3M | FallibleVec::try_push(&mut self.inner, value) | 153 | 59.3M | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::push |
154 | | |
155 | | #[inline(always)] |
156 | 788k | pub fn reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { |
157 | 788k | FallibleVec::try_reserve(&mut self.inner, additional) |
158 | 788k | } <fallible_collections::vec::TryVec<fallible_collections::vec::TryVec<u8>>>::reserve Line | Count | Source | 156 | 2.39k | pub fn reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 157 | 2.39k | FallibleVec::try_reserve(&mut self.inner, additional) | 158 | 2.39k | } |
<fallible_collections::vec::TryVec<mp4parse::SingleItemTypeReferenceBox>>::reserve Line | Count | Source | 156 | 2 | pub fn reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 157 | 2 | FallibleVec::try_reserve(&mut self.inner, additional) | 158 | 2 | } |
<fallible_collections::vec::TryVec<u32>>::reserve Line | Count | Source | 156 | 18.1k | pub fn reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 157 | 18.1k | FallibleVec::try_reserve(&mut self.inner, additional) | 158 | 18.1k | } |
<fallible_collections::vec::TryVec<u8>>::reserve Line | Count | Source | 156 | 768k | pub fn reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 157 | 768k | FallibleVec::try_reserve(&mut self.inner, additional) | 158 | 768k | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_>>::reserve |
159 | | |
160 | | #[inline(always)] |
161 | 0 | pub fn resize_with<F>(&mut self, new_len: usize, f: F) -> Result<(), TryReserveError> |
162 | 0 | where |
163 | 0 | F: FnMut() -> T, |
164 | | { |
165 | 0 | FallibleVec::try_resize_with(&mut self.inner, new_len, f) |
166 | 0 | } |
167 | | } |
168 | | |
169 | | impl<T: TryClone> TryClone for TryVec<T> { |
170 | | #[inline] |
171 | 0 | fn try_clone(&self) -> Result<Self, TryReserveError> { |
172 | 0 | self.as_slice().try_into() |
173 | 0 | } |
174 | | } |
175 | | |
176 | | impl<T: TryClone> TryVec<TryVec<T>> { |
177 | 0 | pub fn concat(&self) -> Result<TryVec<T>, TryReserveError> { |
178 | 0 | let size = self.iter().map(|v| v.inner.len()).sum(); |
179 | 0 | let mut result = TryVec::with_capacity(size)?; |
180 | 0 | for v in self.iter() { |
181 | 0 | result.inner.try_extend_from_slice_no_copy(&v.inner)?; |
182 | | } |
183 | 0 | Ok(result) |
184 | 0 | } |
185 | | } |
186 | | |
187 | | impl<T: TryClone> TryVec<T> { |
188 | | #[inline(always)] |
189 | 115k | pub fn extend_from_slice(&mut self, other: &[T]) -> Result<(), TryReserveError> { |
190 | 115k | self.inner.try_extend_from_slice_no_copy(other) |
191 | 115k | } <fallible_collections::vec::TryVec<u8>>::extend_from_slice Line | Count | Source | 189 | 5.91k | pub fn extend_from_slice(&mut self, other: &[T]) -> Result<(), TryReserveError> { | 190 | 5.91k | self.inner.try_extend_from_slice_no_copy(other) | 191 | 5.91k | } |
<fallible_collections::vec::TryVec<u8>>::extend_from_slice Line | Count | Source | 189 | 12.6k | pub fn extend_from_slice(&mut self, other: &[T]) -> Result<(), TryReserveError> { | 190 | 12.6k | self.inner.try_extend_from_slice_no_copy(other) | 191 | 12.6k | } |
<fallible_collections::vec::TryVec<u8>>::extend_from_slice Line | Count | Source | 189 | 96.8k | pub fn extend_from_slice(&mut self, other: &[T]) -> Result<(), TryReserveError> { | 190 | 96.8k | self.inner.try_extend_from_slice_no_copy(other) | 191 | 96.8k | } |
|
192 | | } |
193 | | |
194 | | impl<T> IntoIterator for TryVec<T> { |
195 | | type Item = T; |
196 | | type IntoIter = alloc::vec::IntoIter<T>; |
197 | | |
198 | | #[inline(always)] |
199 | 34 | fn into_iter(self) -> Self::IntoIter { |
200 | 34 | self.inner.into_iter() |
201 | 34 | } <fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 199 | 18 | fn into_iter(self) -> Self::IntoIter { | 200 | 18 | self.inner.into_iter() | 201 | 18 | } |
<fallible_collections::vec::TryVec<mp4parse::Extent> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 199 | 16 | fn into_iter(self) -> Self::IntoIter { | 200 | 16 | self.inner.into_iter() | 201 | 16 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_> as core::iter::traits::collect::IntoIterator>::into_iter |
202 | | } |
203 | | |
204 | | impl<'a, T> IntoIterator for &'a TryVec<T> { |
205 | | type Item = &'a T; |
206 | | type IntoIter = alloc::slice::Iter<'a, T>; |
207 | | |
208 | | #[inline(always)] |
209 | 558 | fn into_iter(self) -> Self::IntoIter { |
210 | 558 | self.inner.iter() |
211 | 558 | } <&fallible_collections::vec::TryVec<mp4parse::SampleEntry> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 209 | 5 | fn into_iter(self) -> Self::IntoIter { | 210 | 5 | self.inner.iter() | 211 | 5 | } |
<&fallible_collections::vec::TryVec<mp4parse::ProtectionSystemSpecificHeaderBox> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 209 | 276 | fn into_iter(self) -> Self::IntoIter { | 210 | 276 | self.inner.iter() | 211 | 276 | } |
<&fallible_collections::vec::TryVec<mp4parse::Association> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 209 | 19 | fn into_iter(self) -> Self::IntoIter { | 210 | 19 | self.inner.iter() | 211 | 19 | } |
<&fallible_collections::vec::TryVec<mp4parse::DataBox> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 209 | 6 | fn into_iter(self) -> Self::IntoIter { | 210 | 6 | self.inner.iter() | 211 | 6 | } |
<&fallible_collections::vec::TryVec<mp4parse::Association> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 209 | 105 | fn into_iter(self) -> Self::IntoIter { | 210 | 105 | self.inner.iter() | 211 | 105 | } |
<&fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 209 | 95 | fn into_iter(self) -> Self::IntoIter { | 210 | 95 | self.inner.iter() | 211 | 95 | } |
<&fallible_collections::vec::TryVec<u32> as core::iter::traits::collect::IntoIterator>::into_iter Line | Count | Source | 209 | 52 | fn into_iter(self) -> Self::IntoIter { | 210 | 52 | self.inner.iter() | 211 | 52 | } |
Unexecuted instantiation: <&fallible_collections::vec::TryVec<_> as core::iter::traits::collect::IntoIterator>::into_iter |
212 | | } |
213 | | |
214 | | #[cfg(feature = "std_io")] |
215 | | pub mod std_io { |
216 | | use super::*; |
217 | | use std::io::{self, Read, Take, Write}; |
218 | | |
219 | | pub trait TryRead { |
220 | | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize>; |
221 | | |
222 | | #[inline] |
223 | 767k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { |
224 | 767k | let mut buf = TryVec::new(); |
225 | 767k | self.try_read_to_end(&mut buf)?; |
226 | 767k | Ok(buf) |
227 | 767k | } <mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 1.31k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 1.31k | let mut buf = TryVec::new(); | 225 | 1.31k | self.try_read_to_end(&mut buf)?; | 226 | 1.31k | Ok(buf) | 227 | 1.31k | } |
<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 3.45k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 3.45k | let mut buf = TryVec::new(); | 225 | 3.45k | self.try_read_to_end(&mut buf)?; | 226 | 3.45k | Ok(buf) | 227 | 3.45k | } |
<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 5.14k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 5.14k | let mut buf = TryVec::new(); | 225 | 5.14k | self.try_read_to_end(&mut buf)?; | 226 | 5.14k | Ok(buf) | 227 | 5.14k | } |
<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 31.9k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 31.9k | let mut buf = TryVec::new(); | 225 | 31.9k | self.try_read_to_end(&mut buf)?; | 226 | 31.9k | Ok(buf) | 227 | 31.9k | } |
<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 182 | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 182 | let mut buf = TryVec::new(); | 225 | 182 | self.try_read_to_end(&mut buf)?; | 226 | 182 | Ok(buf) | 227 | 182 | } |
<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 22.6k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 22.6k | let mut buf = TryVec::new(); | 225 | 22.6k | self.try_read_to_end(&mut buf)?; | 226 | 22.6k | Ok(buf) | 227 | 22.6k | } |
<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 33 | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 33 | let mut buf = TryVec::new(); | 225 | 33 | self.try_read_to_end(&mut buf)?; | 226 | 33 | Ok(buf) | 227 | 33 | } |
<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 5.63k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 5.63k | let mut buf = TryVec::new(); | 225 | 5.63k | self.try_read_to_end(&mut buf)?; | 226 | 5.63k | Ok(buf) | 227 | 5.63k | } |
<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 17.7k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 17.7k | let mut buf = TryVec::new(); | 225 | 17.7k | self.try_read_to_end(&mut buf)?; | 226 | 17.7k | Ok(buf) | 227 | 17.7k | } |
<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 34.2k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 34.2k | let mut buf = TryVec::new(); | 225 | 34.2k | self.try_read_to_end(&mut buf)?; | 226 | 33.8k | Ok(buf) | 227 | 34.2k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 535 | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 535 | let mut buf = TryVec::new(); | 225 | 535 | self.try_read_to_end(&mut buf)?; | 226 | 535 | Ok(buf) | 227 | 535 | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 9.54k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 9.54k | let mut buf = TryVec::new(); | 225 | 9.54k | self.try_read_to_end(&mut buf)?; | 226 | 9.54k | Ok(buf) | 227 | 9.54k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 1.50k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 1.50k | let mut buf = TryVec::new(); | 225 | 1.50k | self.try_read_to_end(&mut buf)?; | 226 | 1.50k | Ok(buf) | 227 | 1.50k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 6.85k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 6.85k | let mut buf = TryVec::new(); | 225 | 6.85k | self.try_read_to_end(&mut buf)?; | 226 | 6.85k | Ok(buf) | 227 | 6.85k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 91.0k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 91.0k | let mut buf = TryVec::new(); | 225 | 91.0k | self.try_read_to_end(&mut buf)?; | 226 | 91.0k | Ok(buf) | 227 | 91.0k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 356k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 356k | let mut buf = TryVec::new(); | 225 | 356k | self.try_read_to_end(&mut buf)?; | 226 | 356k | Ok(buf) | 227 | 356k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 82 | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 82 | let mut buf = TryVec::new(); | 225 | 82 | self.try_read_to_end(&mut buf)?; | 226 | 82 | Ok(buf) | 227 | 82 | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 1.41k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 1.41k | let mut buf = TryVec::new(); | 225 | 1.41k | self.try_read_to_end(&mut buf)?; | 226 | 1.41k | Ok(buf) | 227 | 1.41k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 3.51k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 3.51k | let mut buf = TryVec::new(); | 225 | 3.51k | self.try_read_to_end(&mut buf)?; | 226 | 3.51k | Ok(buf) | 227 | 3.51k | } |
<std::io::Take<&mut std::io::cursor::Cursor<&fallible_collections::vec::TryVec<u8>>> as fallible_collections::vec::std_io::TryRead>::read_into_try_vec Line | Count | Source | 223 | 174k | fn read_into_try_vec(&mut self) -> io::Result<TryVec<u8>> { | 224 | 174k | let mut buf = TryVec::new(); | 225 | 174k | self.try_read_to_end(&mut buf)?; | 226 | 174k | Ok(buf) | 227 | 174k | } |
Unexecuted instantiation: <_ as fallible_collections::vec::std_io::TryRead>::read_into_try_vec |
228 | | } |
229 | | |
230 | | impl<T: Read> TryRead for Take<T> { |
231 | | /// This function reserves the upper limit of what `src` can generate before |
232 | | /// reading all bytes until EOF in this source, placing them into `buf`. If the |
233 | | /// allocation is unsuccessful, or reading from the source generates an error |
234 | | /// before reaching EOF, this will return an error. Otherwise, it will return |
235 | | /// the number of bytes read. |
236 | | /// |
237 | | /// Since `Take::limit()` may return a value greater than the number of bytes |
238 | | /// which can be read from the source, it's possible this function may fail |
239 | | /// in the allocation phase even though allocating the number of bytes available |
240 | | /// to read would have succeeded. In general, it is assumed that the callers |
241 | | /// have accurate knowledge of the number of bytes of interest and have created |
242 | | /// `src` accordingly. |
243 | | #[inline] |
244 | 702k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { |
245 | 702k | try_read_up_to(self, self.limit(), buf) |
246 | 702k | } <std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 33 | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 33 | try_read_up_to(self, self.limit(), buf) | 246 | 33 | } |
<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 5.63k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 5.63k | try_read_up_to(self, self.limit(), buf) | 246 | 5.63k | } |
<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 17.7k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 17.7k | try_read_up_to(self, self.limit(), buf) | 246 | 17.7k | } |
<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 34.2k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 34.2k | try_read_up_to(self, self.limit(), buf) | 246 | 34.2k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 535 | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 535 | try_read_up_to(self, self.limit(), buf) | 246 | 535 | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 9.54k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 9.54k | try_read_up_to(self, self.limit(), buf) | 246 | 9.54k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 1.50k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 1.50k | try_read_up_to(self, self.limit(), buf) | 246 | 1.50k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 6.85k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 6.85k | try_read_up_to(self, self.limit(), buf) | 246 | 6.85k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 91.0k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 91.0k | try_read_up_to(self, self.limit(), buf) | 246 | 91.0k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 356k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 356k | try_read_up_to(self, self.limit(), buf) | 246 | 356k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 82 | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 82 | try_read_up_to(self, self.limit(), buf) | 246 | 82 | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 1.41k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 1.41k | try_read_up_to(self, self.limit(), buf) | 246 | 1.41k | } |
<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 3.51k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 3.51k | try_read_up_to(self, self.limit(), buf) | 246 | 3.51k | } |
<std::io::Take<&mut std::io::cursor::Cursor<&fallible_collections::vec::TryVec<u8>>> as fallible_collections::vec::std_io::TryRead>::try_read_to_end Line | Count | Source | 244 | 174k | fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> io::Result<usize> { | 245 | 174k | try_read_up_to(self, self.limit(), buf) | 246 | 174k | } |
Unexecuted instantiation: <std::io::Take<_> as fallible_collections::vec::std_io::TryRead>::try_read_to_end |
247 | | } |
248 | | |
249 | | /// Read up to `limit` bytes from `src`, placing them into `buf` and returning the |
250 | | /// number of bytes read. Space for `limit` additional bytes is reserved in `buf`, so |
251 | | /// this function will return an error if the allocation fails. |
252 | 768k | pub fn try_read_up_to<R: Read>( |
253 | 768k | src: &mut R, |
254 | 768k | limit: u64, |
255 | 768k | buf: &mut TryVec<u8>, |
256 | 768k | ) -> io::Result<usize> { |
257 | 768k | let additional = limit |
258 | 768k | .try_into() |
259 | 768k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::cursor::Cursor<&fallible_collections::vec::TryVec<u8>>>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<&mut mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>::{closure#0} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<_>::{closure#0} |
260 | 768k | buf.reserve(additional) |
261 | 768k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>::{closure#1} fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>::{closure#1} Line | Count | Source | 261 | 42 | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>::{closure#1} Line | Count | Source | 261 | 335 | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; |
Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::cursor::Cursor<&fallible_collections::vec::TryVec<u8>>>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<&mut mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>::{closure#1} Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<_>::{closure#1} |
262 | 767k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; |
263 | 767k | Ok(bytes_read) |
264 | 768k | } fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>> Line | Count | Source | 252 | 1.31k | pub fn try_read_up_to<R: Read>( | 253 | 1.31k | src: &mut R, | 254 | 1.31k | limit: u64, | 255 | 1.31k | buf: &mut TryVec<u8>, | 256 | 1.31k | ) -> io::Result<usize> { | 257 | 1.31k | let additional = limit | 258 | 1.31k | .try_into() | 259 | 1.31k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 1.31k | buf.reserve(additional) | 261 | 1.31k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 1.31k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 1.31k | Ok(bytes_read) | 264 | 1.31k | } |
fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>> Line | Count | Source | 252 | 3.45k | pub fn try_read_up_to<R: Read>( | 253 | 3.45k | src: &mut R, | 254 | 3.45k | limit: u64, | 255 | 3.45k | buf: &mut TryVec<u8>, | 256 | 3.45k | ) -> io::Result<usize> { | 257 | 3.45k | let additional = limit | 258 | 3.45k | .try_into() | 259 | 3.45k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 3.45k | buf.reserve(additional) | 261 | 3.45k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 3.45k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 3.45k | Ok(bytes_read) | 264 | 3.45k | } |
fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>> Line | Count | Source | 252 | 5.42k | pub fn try_read_up_to<R: Read>( | 253 | 5.42k | src: &mut R, | 254 | 5.42k | limit: u64, | 255 | 5.42k | buf: &mut TryVec<u8>, | 256 | 5.42k | ) -> io::Result<usize> { | 257 | 5.42k | let additional = limit | 258 | 5.42k | .try_into() | 259 | 5.42k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 5.42k | buf.reserve(additional) | 261 | 5.42k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 5.42k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 5.42k | Ok(bytes_read) | 264 | 5.42k | } |
fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>> Line | Count | Source | 252 | 31.9k | pub fn try_read_up_to<R: Read>( | 253 | 31.9k | src: &mut R, | 254 | 31.9k | limit: u64, | 255 | 31.9k | buf: &mut TryVec<u8>, | 256 | 31.9k | ) -> io::Result<usize> { | 257 | 31.9k | let additional = limit | 258 | 31.9k | .try_into() | 259 | 31.9k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 31.9k | buf.reserve(additional) | 261 | 31.9k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 31.9k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 31.9k | Ok(bytes_read) | 264 | 31.9k | } |
fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>> Line | Count | Source | 252 | 182 | pub fn try_read_up_to<R: Read>( | 253 | 182 | src: &mut R, | 254 | 182 | limit: u64, | 255 | 182 | buf: &mut TryVec<u8>, | 256 | 182 | ) -> io::Result<usize> { | 257 | 182 | let additional = limit | 258 | 182 | .try_into() | 259 | 182 | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 182 | buf.reserve(additional) | 261 | 182 | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 182 | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 182 | Ok(bytes_read) | 264 | 182 | } |
fallible_collections::vec::std_io::try_read_up_to::<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>> Line | Count | Source | 252 | 22.6k | pub fn try_read_up_to<R: Read>( | 253 | 22.6k | src: &mut R, | 254 | 22.6k | limit: u64, | 255 | 22.6k | buf: &mut TryVec<u8>, | 256 | 22.6k | ) -> io::Result<usize> { | 257 | 22.6k | let additional = limit | 258 | 22.6k | .try_into() | 259 | 22.6k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 22.6k | buf.reserve(additional) | 261 | 22.6k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 22.6k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 22.6k | Ok(bytes_read) | 264 | 22.6k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>> Line | Count | Source | 252 | 33 | pub fn try_read_up_to<R: Read>( | 253 | 33 | src: &mut R, | 254 | 33 | limit: u64, | 255 | 33 | buf: &mut TryVec<u8>, | 256 | 33 | ) -> io::Result<usize> { | 257 | 33 | let additional = limit | 258 | 33 | .try_into() | 259 | 33 | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 33 | buf.reserve(additional) | 261 | 33 | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 33 | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 33 | Ok(bytes_read) | 264 | 33 | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>> Line | Count | Source | 252 | 5.63k | pub fn try_read_up_to<R: Read>( | 253 | 5.63k | src: &mut R, | 254 | 5.63k | limit: u64, | 255 | 5.63k | buf: &mut TryVec<u8>, | 256 | 5.63k | ) -> io::Result<usize> { | 257 | 5.63k | let additional = limit | 258 | 5.63k | .try_into() | 259 | 5.63k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 5.63k | buf.reserve(additional) | 261 | 5.63k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 5.63k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 5.63k | Ok(bytes_read) | 264 | 5.63k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>> Line | Count | Source | 252 | 17.7k | pub fn try_read_up_to<R: Read>( | 253 | 17.7k | src: &mut R, | 254 | 17.7k | limit: u64, | 255 | 17.7k | buf: &mut TryVec<u8>, | 256 | 17.7k | ) -> io::Result<usize> { | 257 | 17.7k | let additional = limit | 258 | 17.7k | .try_into() | 259 | 17.7k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 17.7k | buf.reserve(additional) | 261 | 17.7k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 17.7k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 17.7k | Ok(bytes_read) | 264 | 17.7k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>> Line | Count | Source | 252 | 34.2k | pub fn try_read_up_to<R: Read>( | 253 | 34.2k | src: &mut R, | 254 | 34.2k | limit: u64, | 255 | 34.2k | buf: &mut TryVec<u8>, | 256 | 34.2k | ) -> io::Result<usize> { | 257 | 34.2k | let additional = limit | 258 | 34.2k | .try_into() | 259 | 34.2k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 34.2k | buf.reserve(additional) | 261 | 34.2k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 33.8k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 33.8k | Ok(bytes_read) | 264 | 34.2k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>>> Line | Count | Source | 252 | 535 | pub fn try_read_up_to<R: Read>( | 253 | 535 | src: &mut R, | 254 | 535 | limit: u64, | 255 | 535 | buf: &mut TryVec<u8>, | 256 | 535 | ) -> io::Result<usize> { | 257 | 535 | let additional = limit | 258 | 535 | .try_into() | 259 | 535 | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 535 | buf.reserve(additional) | 261 | 535 | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 535 | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 535 | Ok(bytes_read) | 264 | 535 | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>>> Line | Count | Source | 252 | 9.54k | pub fn try_read_up_to<R: Read>( | 253 | 9.54k | src: &mut R, | 254 | 9.54k | limit: u64, | 255 | 9.54k | buf: &mut TryVec<u8>, | 256 | 9.54k | ) -> io::Result<usize> { | 257 | 9.54k | let additional = limit | 258 | 9.54k | .try_into() | 259 | 9.54k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 9.54k | buf.reserve(additional) | 261 | 9.54k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 9.54k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 9.54k | Ok(bytes_read) | 264 | 9.54k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>>> Line | Count | Source | 252 | 1.50k | pub fn try_read_up_to<R: Read>( | 253 | 1.50k | src: &mut R, | 254 | 1.50k | limit: u64, | 255 | 1.50k | buf: &mut TryVec<u8>, | 256 | 1.50k | ) -> io::Result<usize> { | 257 | 1.50k | let additional = limit | 258 | 1.50k | .try_into() | 259 | 1.50k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 1.50k | buf.reserve(additional) | 261 | 1.50k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 1.50k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 1.50k | Ok(bytes_read) | 264 | 1.50k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>>> Line | Count | Source | 252 | 6.85k | pub fn try_read_up_to<R: Read>( | 253 | 6.85k | src: &mut R, | 254 | 6.85k | limit: u64, | 255 | 6.85k | buf: &mut TryVec<u8>, | 256 | 6.85k | ) -> io::Result<usize> { | 257 | 6.85k | let additional = limit | 258 | 6.85k | .try_into() | 259 | 6.85k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 6.85k | buf.reserve(additional) | 261 | 6.85k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 6.85k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 6.85k | Ok(bytes_read) | 264 | 6.85k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>>>>>>> Line | Count | Source | 252 | 91.0k | pub fn try_read_up_to<R: Read>( | 253 | 91.0k | src: &mut R, | 254 | 91.0k | limit: u64, | 255 | 91.0k | buf: &mut TryVec<u8>, | 256 | 91.0k | ) -> io::Result<usize> { | 257 | 91.0k | let additional = limit | 258 | 91.0k | .try_into() | 259 | 91.0k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 91.0k | buf.reserve(additional) | 261 | 91.0k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 91.0k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 91.0k | Ok(bytes_read) | 264 | 91.0k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>>>>>>>> Line | Count | Source | 252 | 356k | pub fn try_read_up_to<R: Read>( | 253 | 356k | src: &mut R, | 254 | 356k | limit: u64, | 255 | 356k | buf: &mut TryVec<u8>, | 256 | 356k | ) -> io::Result<usize> { | 257 | 356k | let additional = limit | 258 | 356k | .try_into() | 259 | 356k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 356k | buf.reserve(additional) | 261 | 356k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 356k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 356k | Ok(bytes_read) | 264 | 356k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>>> Line | Count | Source | 252 | 82 | pub fn try_read_up_to<R: Read>( | 253 | 82 | src: &mut R, | 254 | 82 | limit: u64, | 255 | 82 | buf: &mut TryVec<u8>, | 256 | 82 | ) -> io::Result<usize> { | 257 | 82 | let additional = limit | 258 | 82 | .try_into() | 259 | 82 | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 82 | buf.reserve(additional) | 261 | 82 | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 82 | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 82 | Ok(bytes_read) | 264 | 82 | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>>>>> Line | Count | Source | 252 | 1.41k | pub fn try_read_up_to<R: Read>( | 253 | 1.41k | src: &mut R, | 254 | 1.41k | limit: u64, | 255 | 1.41k | buf: &mut TryVec<u8>, | 256 | 1.41k | ) -> io::Result<usize> { | 257 | 1.41k | let additional = limit | 258 | 1.41k | .try_into() | 259 | 1.41k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 1.41k | buf.reserve(additional) | 261 | 1.41k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 1.41k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 1.41k | Ok(bytes_read) | 264 | 1.41k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::Mp4parseIo>>>> Line | Count | Source | 252 | 3.51k | pub fn try_read_up_to<R: Read>( | 253 | 3.51k | src: &mut R, | 254 | 3.51k | limit: u64, | 255 | 3.51k | buf: &mut TryVec<u8>, | 256 | 3.51k | ) -> io::Result<usize> { | 257 | 3.51k | let additional = limit | 258 | 3.51k | .try_into() | 259 | 3.51k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 3.51k | buf.reserve(additional) | 261 | 3.51k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 3.51k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 3.51k | Ok(bytes_read) | 264 | 3.51k | } |
fallible_collections::vec::std_io::try_read_up_to::<std::io::Take<&mut std::io::cursor::Cursor<&fallible_collections::vec::TryVec<u8>>>> Line | Count | Source | 252 | 174k | pub fn try_read_up_to<R: Read>( | 253 | 174k | src: &mut R, | 254 | 174k | limit: u64, | 255 | 174k | buf: &mut TryVec<u8>, | 256 | 174k | ) -> io::Result<usize> { | 257 | 174k | let additional = limit | 258 | 174k | .try_into() | 259 | 174k | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 174k | buf.reserve(additional) | 261 | 174k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 174k | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 174k | Ok(bytes_read) | 264 | 174k | } |
fallible_collections::vec::std_io::try_read_up_to::<&mut mp4parse::OffsetReader<mp4parse_capi::Mp4parseIo>> Line | Count | Source | 252 | 406 | pub fn try_read_up_to<R: Read>( | 253 | 406 | src: &mut R, | 254 | 406 | limit: u64, | 255 | 406 | buf: &mut TryVec<u8>, | 256 | 406 | ) -> io::Result<usize> { | 257 | 406 | let additional = limit | 258 | 406 | .try_into() | 259 | 406 | .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; | 260 | 406 | buf.reserve(additional) | 261 | 406 | .map_err(|_| io::Error::new(io::ErrorKind::Other, "reserve allocation failed"))?; | 262 | 406 | let bytes_read = src.take(limit).read_to_end(&mut buf.inner)?; | 263 | 406 | Ok(bytes_read) | 264 | 406 | } |
Unexecuted instantiation: fallible_collections::vec::std_io::try_read_up_to::<_> |
265 | | |
266 | | impl Write for TryVec<u8> { |
267 | 96.8k | fn write(&mut self, buf: &[u8]) -> io::Result<usize> { |
268 | 96.8k | self.extend_from_slice(buf) |
269 | 96.8k | .map_err(|_| io::Error::new(io::ErrorKind::Other, "extend_from_slice failed"))?; |
270 | 96.8k | Ok(buf.len()) |
271 | 96.8k | } |
272 | | |
273 | | #[inline(always)] |
274 | 0 | fn flush(&mut self) -> io::Result<()> { |
275 | 0 | Ok(()) |
276 | 0 | } |
277 | | } |
278 | | |
279 | | #[cfg(test)] |
280 | | mod tests { |
281 | | use super::*; |
282 | | |
283 | | #[test] |
284 | | fn try_read_to_end() { |
285 | | let mut src = b"1234567890".take(5); |
286 | | let mut buf = TryVec::new(); |
287 | | src.try_read_to_end(&mut buf).unwrap(); |
288 | | assert_eq!(buf.len(), 5); |
289 | | assert_eq!(buf, b"12345".as_ref()); |
290 | | } |
291 | | |
292 | | #[test] |
293 | | fn read_into_try_vec() { |
294 | | let mut src = b"1234567890".take(5); |
295 | | let buf = src.read_into_try_vec().unwrap(); |
296 | | assert_eq!(buf.len(), 5); |
297 | | assert_eq!(buf, b"12345".as_ref()); |
298 | | } |
299 | | |
300 | | #[test] |
301 | | fn read_into_try_vec_oom() { |
302 | | let mut src = b"1234567890".take(core::usize::MAX.try_into().expect("usize < u64")); |
303 | | assert!(src.read_into_try_vec().is_err()); |
304 | | } |
305 | | |
306 | | #[test] |
307 | | fn try_read_up_to() { |
308 | | let src = b"1234567890"; |
309 | | let mut buf = TryVec::new(); |
310 | | super::try_read_up_to(&mut src.as_ref(), 5, &mut buf).unwrap(); |
311 | | assert_eq!(buf.len(), 5); |
312 | | assert_eq!(buf, b"12345".as_ref()); |
313 | | } |
314 | | |
315 | | #[test] |
316 | | fn try_read_up_to_oom() { |
317 | | let src = b"1234567890"; |
318 | | let mut buf = TryVec::new(); |
319 | | let limit = core::usize::MAX.try_into().expect("usize < u64"); |
320 | | let res = super::try_read_up_to(&mut src.as_ref(), limit, &mut buf); |
321 | | assert!(res.is_err()); |
322 | | } |
323 | | } |
324 | | } |
325 | | |
326 | | impl<T: PartialEq> PartialEq<Vec<T>> for TryVec<T> { |
327 | | #[inline(always)] |
328 | 0 | fn eq(&self, other: &Vec<T>) -> bool { |
329 | 0 | self.inner.eq(other) |
330 | 0 | } |
331 | | } |
332 | | |
333 | | impl<'a, T: PartialEq> PartialEq<&'a [T]> for TryVec<T> { |
334 | | #[inline(always)] |
335 | 0 | fn eq(&self, other: &&[T]) -> bool { |
336 | 0 | self.inner.eq(other) |
337 | 0 | } |
338 | | } |
339 | | |
340 | | impl PartialEq<&str> for TryVec<u8> { |
341 | | #[inline] |
342 | 0 | fn eq(&self, other: &&str) -> bool { |
343 | 0 | self.as_slice() == other.as_bytes() |
344 | 0 | } |
345 | | } |
346 | | |
347 | | impl core::convert::AsRef<[u8]> for TryVec<u8> { |
348 | | #[inline(always)] |
349 | 198k | fn as_ref(&self) -> &[u8] { |
350 | 198k | self.inner.as_ref() |
351 | 198k | } |
352 | | } |
353 | | |
354 | | impl<T> core::convert::From<Vec<T>> for TryVec<T> { |
355 | | #[inline(always)] |
356 | 0 | fn from(value: Vec<T>) -> Self { |
357 | 0 | Self { inner: value } |
358 | 0 | } |
359 | | } |
360 | | |
361 | | impl<T: TryClone> core::convert::TryFrom<&[T]> for TryVec<T> { |
362 | | type Error = TryReserveError; |
363 | | |
364 | | #[inline] |
365 | 276 | fn try_from(value: &[T]) -> Result<Self, Self::Error> { |
366 | 276 | let mut v = Self::new(); |
367 | 276 | v.inner.try_extend_from_slice_no_copy(value)?; |
368 | 276 | Ok(v) |
369 | 276 | } <fallible_collections::vec::TryVec<u8> as core::convert::TryFrom<&[u8]>>::try_from Line | Count | Source | 365 | 276 | fn try_from(value: &[T]) -> Result<Self, Self::Error> { | 366 | 276 | let mut v = Self::new(); | 367 | 276 | v.inner.try_extend_from_slice_no_copy(value)?; | 368 | 276 | Ok(v) | 369 | 276 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_> as core::convert::TryFrom<&[_]>>::try_from |
370 | | } |
371 | | |
372 | | impl core::convert::TryFrom<&str> for TryVec<u8> { |
373 | | type Error = TryReserveError; |
374 | | |
375 | | #[inline] |
376 | 0 | fn try_from(value: &str) -> Result<Self, Self::Error> { |
377 | 0 | let mut v = Self::new(); |
378 | 0 | v.extend_from_slice(value.as_bytes())?; |
379 | 0 | Ok(v) |
380 | 0 | } |
381 | | } |
382 | | |
383 | | impl<T> core::ops::Deref for TryVec<T> { |
384 | | type Target = [T]; |
385 | | |
386 | | #[inline(always)] |
387 | 574M | fn deref(&self) -> &[T] { |
388 | 574M | self.inner.deref() |
389 | 574M | } <fallible_collections::vec::TryVec<mp4parse::SampleEntry> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 186k | fn deref(&self) -> &[T] { | 388 | 186k | self.inner.deref() | 389 | 186k | } |
<fallible_collections::vec::TryVec<mp4parse::FLACMetadataBlock> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 18 | fn deref(&self) -> &[T] { | 388 | 18 | self.inner.deref() | 389 | 18 | } |
<fallible_collections::vec::TryVec<mp4parse::Track> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 176k | fn deref(&self) -> &[T] { | 388 | 176k | self.inner.deref() | 389 | 176k | } |
<fallible_collections::vec::TryVec<mp4parse_capi::Mp4parseTrackAudioSampleInfo> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 41.3k | fn deref(&self) -> &[T] { | 388 | 41.3k | self.inner.deref() | 389 | 41.3k | } |
<fallible_collections::vec::TryVec<mp4parse_capi::Mp4parseTrackVideoSampleInfo> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 14.3k | fn deref(&self) -> &[T] { | 388 | 14.3k | self.inner.deref() | 389 | 14.3k | } |
<fallible_collections::vec::TryVec<mp4parse::unstable::Indice> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 330 | fn deref(&self) -> &[T] { | 388 | 330 | self.inner.deref() | 389 | 330 | } |
<fallible_collections::vec::TryVec<u8> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 816k | fn deref(&self) -> &[T] { | 388 | 816k | self.inner.deref() | 389 | 816k | } |
<fallible_collections::vec::TryVec<mp4parse::ItemPropertyAssociationEntry> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 19 | fn deref(&self) -> &[T] { | 388 | 19 | self.inner.deref() | 389 | 19 | } |
<fallible_collections::vec::TryVec<mp4parse::Edit> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 31.7k | fn deref(&self) -> &[T] { | 388 | 31.7k | self.inner.deref() | 389 | 31.7k | } |
<fallible_collections::vec::TryVec<mp4parse::Extent> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 16 | fn deref(&self) -> &[T] { | 388 | 16 | self.inner.deref() | 389 | 16 | } |
<fallible_collections::vec::TryVec<mp4parse::ItemId> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 31 | fn deref(&self) -> &[T] { | 388 | 31 | self.inner.deref() | 389 | 31 | } |
<fallible_collections::vec::TryVec<(u8, u32)> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 18 | fn deref(&self) -> &[T] { | 388 | 18 | self.inner.deref() | 389 | 18 | } |
<fallible_collections::vec::TryVec<mp4parse::boxes::FourCC> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 2.08k | fn deref(&self) -> &[T] { | 388 | 2.08k | self.inner.deref() | 389 | 2.08k | } |
<fallible_collections::vec::TryVec<&mp4parse::ItemProperty> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 101 | fn deref(&self) -> &[T] { | 388 | 101 | self.inner.deref() | 389 | 101 | } |
<fallible_collections::vec::TryVec<u8> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 42 | fn deref(&self) -> &[T] { | 388 | 42 | self.inner.deref() | 389 | 42 | } |
<fallible_collections::vec::TryVec<mp4parse::TimeOffset> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 49 | fn deref(&self) -> &[T] { | 388 | 49 | self.inner.deref() | 389 | 49 | } |
<fallible_collections::vec::TryVec<mp4parse::unstable::Indice> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 573M | fn deref(&self) -> &[T] { | 388 | 573M | self.inner.deref() | 389 | 573M | } |
<fallible_collections::vec::TryVec<u32> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 44 | fn deref(&self) -> &[T] { | 388 | 44 | self.inner.deref() | 389 | 44 | } |
<fallible_collections::vec::TryVec<mp4parse::SampleToChunk> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 715 | fn deref(&self) -> &[T] { | 388 | 715 | self.inner.deref() | 389 | 715 | } |
<fallible_collections::vec::TryVec<mp4parse::Sample> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 330 | fn deref(&self) -> &[T] { | 388 | 330 | self.inner.deref() | 389 | 330 | } |
<fallible_collections::vec::TryVec<usize> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 54 | fn deref(&self) -> &[T] { | 388 | 54 | self.inner.deref() | 389 | 54 | } |
<fallible_collections::vec::TryVec<u64> as core::ops::deref::Deref>::deref Line | Count | Source | 387 | 92.7k | fn deref(&self) -> &[T] { | 388 | 92.7k | self.inner.deref() | 389 | 92.7k | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_> as core::ops::deref::Deref>::deref |
390 | | } |
391 | | |
392 | | impl<T> core::ops::DerefMut for TryVec<T> { |
393 | 59.3M | fn deref_mut(&mut self) -> &mut [T] { |
394 | 59.3M | self.inner.deref_mut() |
395 | 59.3M | } <fallible_collections::vec::TryVec<mp4parse::unstable::Indice> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 393 | 59.3M | fn deref_mut(&mut self) -> &mut [T] { | 394 | 59.3M | self.inner.deref_mut() | 395 | 59.3M | } |
<fallible_collections::vec::TryVec<usize> as core::ops::deref::DerefMut>::deref_mut Line | Count | Source | 393 | 54 | fn deref_mut(&mut self) -> &mut [T] { | 394 | 54 | self.inner.deref_mut() | 395 | 54 | } |
Unexecuted instantiation: <fallible_collections::vec::TryVec<_> as core::ops::deref::DerefMut>::deref_mut |
396 | | } |
397 | | |
398 | | pub struct Iter<'a, T> { |
399 | | inner: alloc::slice::Iter<'a, T>, |
400 | | } |
401 | | |
402 | | impl<'a, T> Iterator for Iter<'a, T> { |
403 | | type Item = &'a T; |
404 | | |
405 | | #[inline(always)] |
406 | 75.6M | fn next(&mut self) -> Option<Self::Item> { |
407 | 75.6M | self.inner.next() |
408 | 75.6M | } <fallible_collections::vec::Iter<mp4parse::SampleEntry> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 40.0k | fn next(&mut self) -> Option<Self::Item> { | 407 | 40.0k | self.inner.next() | 408 | 40.0k | } |
<fallible_collections::vec::Iter<mp4parse::ItemInfoEntry> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 16 | fn next(&mut self) -> Option<Self::Item> { | 407 | 16 | self.inner.next() | 408 | 16 | } |
<fallible_collections::vec::Iter<mp4parse::SampleToChunk> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 11 | fn next(&mut self) -> Option<Self::Item> { | 407 | 11 | self.inner.next() | 408 | 11 | } |
<fallible_collections::vec::Iter<mp4parse::ProtectionSchemeInfoBox> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 20.4k | fn next(&mut self) -> Option<Self::Item> { | 407 | 20.4k | self.inner.next() | 408 | 20.4k | } |
<fallible_collections::vec::Iter<mp4parse::SingleItemTypeReferenceBox> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 39 | fn next(&mut self) -> Option<Self::Item> { | 407 | 39 | self.inner.next() | 408 | 39 | } |
<fallible_collections::vec::Iter<mp4parse::ItemPropertyAssociationEntry> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 20 | fn next(&mut self) -> Option<Self::Item> { | 407 | 20 | self.inner.next() | 408 | 20 | } |
<fallible_collections::vec::Iter<mp4parse::Track> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 16.2M | fn next(&mut self) -> Option<Self::Item> { | 407 | 16.2M | self.inner.next() | 408 | 16.2M | } |
<fallible_collections::vec::Iter<u8> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 4.49k | fn next(&mut self) -> Option<Self::Item> { | 407 | 4.49k | self.inner.next() | 408 | 4.49k | } |
<fallible_collections::vec::Iter<mp4parse::DataBox> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 24 | fn next(&mut self) -> Option<Self::Item> { | 407 | 24 | self.inner.next() | 408 | 24 | } |
<fallible_collections::vec::Iter<mp4parse::TrackReferenceEntry> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 101 | fn next(&mut self) -> Option<Self::Item> { | 407 | 101 | self.inner.next() | 408 | 101 | } |
<fallible_collections::vec::Iter<u32> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 406 | 59.3M | fn next(&mut self) -> Option<Self::Item> { | 407 | 59.3M | self.inner.next() | 408 | 59.3M | } |
Unexecuted instantiation: <fallible_collections::vec::Iter<_> as core::iter::traits::iterator::Iterator>::next |
409 | | |
410 | | #[inline(always)] |
411 | 0 | fn size_hint(&self) -> (usize, Option<usize>) { |
412 | 0 | self.inner.size_hint() |
413 | 0 | } |
414 | | } |
415 | | |
416 | | pub struct IterMut<'a, T> { |
417 | | inner: alloc::slice::IterMut<'a, T>, |
418 | | } |
419 | | |
420 | | impl<'a, T> Iterator for IterMut<'a, T> { |
421 | | type Item = &'a mut T; |
422 | | |
423 | | #[inline(always)] |
424 | 0 | fn next(&mut self) -> Option<Self::Item> { |
425 | 0 | self.inner.next() |
426 | 0 | } |
427 | | |
428 | | #[inline(always)] |
429 | 0 | fn size_hint(&self) -> (usize, Option<usize>) { |
430 | 0 | self.inner.size_hint() |
431 | 0 | } |
432 | | } |
433 | | |
434 | 115k | fn needs_to_grow<T>(v: &Vec<T>, len: usize) -> bool { |
435 | 115k | v.len() |
436 | 115k | .checked_add(len) |
437 | 115k | .map_or(true, |needed| needed > v.capacity()) |
438 | 115k | } |
439 | | |
440 | | impl<T> FallibleVec<T> for Vec<T> { |
441 | | #[inline(always)] |
442 | 952k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { |
443 | 952k | self.try_reserve(additional) |
444 | 952k | } <alloc::vec::Vec<mp4parse::TimeOffset> as fallible_collections::vec::FallibleVec<mp4parse::TimeOffset>>::try_reserve Line | Count | Source | 442 | 1.38k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 1.38k | self.try_reserve(additional) | 444 | 1.38k | } |
<alloc::vec::Vec<mp4parse::Association> as fallible_collections::vec::FallibleVec<mp4parse::Association>>::try_reserve Line | Count | Source | 442 | 19 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 19 | self.try_reserve(additional) | 444 | 19 | } |
<alloc::vec::Vec<mp4parse::SampleEntry> as fallible_collections::vec::FallibleVec<mp4parse::SampleEntry>>::try_reserve Line | Count | Source | 442 | 32.2k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 32.2k | self.try_reserve(additional) | 444 | 32.2k | } |
<alloc::vec::Vec<mp4parse::ItemInfoEntry> as fallible_collections::vec::FallibleVec<mp4parse::ItemInfoEntry>>::try_reserve Line | Count | Source | 442 | 19 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 19 | self.try_reserve(additional) | 444 | 19 | } |
<alloc::vec::Vec<mp4parse::SampleToChunk> as fallible_collections::vec::FallibleVec<mp4parse::SampleToChunk>>::try_reserve Line | Count | Source | 442 | 30.6k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 30.6k | self.try_reserve(additional) | 444 | 30.6k | } |
<alloc::vec::Vec<mp4parse::TrackReferenceEntry> as fallible_collections::vec::FallibleVec<mp4parse::TrackReferenceEntry>>::try_reserve Line | Count | Source | 442 | 2.39k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 2.39k | self.try_reserve(additional) | 444 | 2.39k | } |
<alloc::vec::Vec<mp4parse::ItemPropertyAssociationEntry> as fallible_collections::vec::FallibleVec<mp4parse::ItemPropertyAssociationEntry>>::try_reserve Line | Count | Source | 442 | 18 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 18 | self.try_reserve(additional) | 444 | 18 | } |
<alloc::vec::Vec<mp4parse::Edit> as fallible_collections::vec::FallibleVec<mp4parse::Edit>>::try_reserve Line | Count | Source | 442 | 10.2k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 10.2k | self.try_reserve(additional) | 444 | 10.2k | } |
<alloc::vec::Vec<mp4parse::Extent> as fallible_collections::vec::FallibleVec<mp4parse::Extent>>::try_reserve Line | Count | Source | 442 | 67 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 67 | self.try_reserve(additional) | 444 | 67 | } |
<alloc::vec::Vec<mp4parse::Sample> as fallible_collections::vec::FallibleVec<mp4parse::Sample>>::try_reserve Line | Count | Source | 442 | 20.8k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 20.8k | self.try_reserve(additional) | 444 | 20.8k | } |
<alloc::vec::Vec<mp4parse_capi::Mp4parseTrackAudioSampleInfo> as fallible_collections::vec::FallibleVec<mp4parse_capi::Mp4parseTrackAudioSampleInfo>>::try_reserve Line | Count | Source | 442 | 15.1k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 15.1k | self.try_reserve(additional) | 444 | 15.1k | } |
<alloc::vec::Vec<mp4parse_capi::Mp4parseTrackVideoSampleInfo> as fallible_collections::vec::FallibleVec<mp4parse_capi::Mp4parseTrackVideoSampleInfo>>::try_reserve Line | Count | Source | 442 | 5.39k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 5.39k | self.try_reserve(additional) | 444 | 5.39k | } |
<alloc::vec::Vec<mp4parse::boxes::FourCC> as fallible_collections::vec::FallibleVec<mp4parse::boxes::FourCC>>::try_reserve Line | Count | Source | 442 | 5.51k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 5.51k | self.try_reserve(additional) | 444 | 5.51k | } |
<alloc::vec::Vec<(u8, u32)> as fallible_collections::vec::FallibleVec<(u8, u32)>>::try_reserve Line | Count | Source | 442 | 18 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 18 | self.try_reserve(additional) | 444 | 18 | } |
<alloc::vec::Vec<u8> as fallible_collections::vec::FallibleVec<u8>>::try_reserve Line | Count | Source | 442 | 772k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 772k | self.try_reserve(additional) | 444 | 772k | } |
<alloc::vec::Vec<u32> as fallible_collections::vec::FallibleVec<u32>>::try_reserve Line | Count | Source | 442 | 23.5k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 23.5k | self.try_reserve(additional) | 444 | 23.5k | } |
<alloc::vec::Vec<u64> as fallible_collections::vec::FallibleVec<u64>>::try_reserve Line | Count | Source | 442 | 28.5k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 28.5k | self.try_reserve(additional) | 444 | 28.5k | } |
<alloc::vec::Vec<fallible_collections::vec::TryVec<u8>> as fallible_collections::vec::FallibleVec<fallible_collections::vec::TryVec<u8>>>::try_reserve Line | Count | Source | 442 | 2.39k | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 2.39k | self.try_reserve(additional) | 444 | 2.39k | } |
<alloc::vec::Vec<mp4parse::SingleItemTypeReferenceBox> as fallible_collections::vec::FallibleVec<mp4parse::SingleItemTypeReferenceBox>>::try_reserve Line | Count | Source | 442 | 2 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 2 | self.try_reserve(additional) | 444 | 2 | } |
<alloc::vec::Vec<mp4parse::unstable::Indice> as fallible_collections::vec::FallibleVec<mp4parse::unstable::Indice>>::try_reserve Line | Count | Source | 442 | 358 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 358 | self.try_reserve(additional) | 444 | 358 | } |
<alloc::vec::Vec<usize> as fallible_collections::vec::FallibleVec<usize>>::try_reserve Line | Count | Source | 442 | 54 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 54 | self.try_reserve(additional) | 444 | 54 | } |
<alloc::vec::Vec<u8> as fallible_collections::vec::FallibleVec<u8>>::try_reserve Line | Count | Source | 442 | 224 | fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> { | 443 | 224 | self.try_reserve(additional) | 444 | 224 | } |
|
445 | | |
446 | | #[inline] |
447 | 122M | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { |
448 | 122M | if self.len() == self.capacity() { |
449 | 43.0k | self.try_reserve(1)?; |
450 | 122M | } |
451 | 122M | Ok(self.push(elem)) |
452 | 122M | } <alloc::vec::Vec<fallible_collections::vec::TryVec<u8>> as fallible_collections::vec::FallibleVec<fallible_collections::vec::TryVec<u8>>>::try_push Line | Count | Source | 447 | 211k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 211k | if self.len() == self.capacity() { | 449 | 36.7k | self.try_reserve(1)?; | 450 | 174k | } | 451 | 211k | Ok(self.push(elem)) | 452 | 211k | } |
<alloc::vec::Vec<mp4parse::TimeOffset> as fallible_collections::vec::FallibleVec<mp4parse::TimeOffset>>::try_push Line | Count | Source | 447 | 382k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 382k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 382k | } | 451 | 382k | Ok(self.push(elem)) | 452 | 382k | } |
<alloc::vec::Vec<mp4parse::Association> as fallible_collections::vec::FallibleVec<mp4parse::Association>>::try_push Line | Count | Source | 447 | 82 | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 82 | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 82 | } | 451 | 82 | Ok(self.push(elem)) | 452 | 82 | } |
<alloc::vec::Vec<mp4parse::SampleEntry> as fallible_collections::vec::FallibleVec<mp4parse::SampleEntry>>::try_push Line | Count | Source | 447 | 133k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 133k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 133k | } | 451 | 133k | Ok(self.push(elem)) | 452 | 133k | } |
<alloc::vec::Vec<mp4parse::ItemInfoEntry> as fallible_collections::vec::FallibleVec<mp4parse::ItemInfoEntry>>::try_push Line | Count | Source | 447 | 17 | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 17 | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 17 | } | 451 | 17 | Ok(self.push(elem)) | 452 | 17 | } |
<alloc::vec::Vec<mp4parse::SampleToChunk> as fallible_collections::vec::FallibleVec<mp4parse::SampleToChunk>>::try_push Line | Count | Source | 447 | 63.3k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 63.3k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 63.3k | } | 451 | 63.3k | Ok(self.push(elem)) | 452 | 63.3k | } |
<alloc::vec::Vec<mp4parse::FLACMetadataBlock> as fallible_collections::vec::FallibleVec<mp4parse::FLACMetadataBlock>>::try_push Line | Count | Source | 447 | 442k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 442k | if self.len() == self.capacity() { | 449 | 296 | self.try_reserve(1)?; | 450 | 442k | } | 451 | 442k | Ok(self.push(elem)) | 452 | 442k | } |
<alloc::vec::Vec<mp4parse::TrackReferenceEntry> as fallible_collections::vec::FallibleVec<mp4parse::TrackReferenceEntry>>::try_push Line | Count | Source | 447 | 2.12k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 2.12k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 2.12k | } | 451 | 2.12k | Ok(self.push(elem)) | 452 | 2.12k | } |
<alloc::vec::Vec<mp4parse::ProtectionSchemeInfoBox> as fallible_collections::vec::FallibleVec<mp4parse::ProtectionSchemeInfoBox>>::try_push Line | Count | Source | 447 | 10.9k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 10.9k | if self.len() == self.capacity() { | 449 | 3.67k | self.try_reserve(1)?; | 450 | 7.25k | } | 451 | 10.9k | Ok(self.push(elem)) | 452 | 10.9k | } |
<alloc::vec::Vec<mp4parse::SingleItemTypeReferenceBox> as fallible_collections::vec::FallibleVec<mp4parse::SingleItemTypeReferenceBox>>::try_push Line | Count | Source | 447 | 21.8k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 21.8k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 21.8k | } | 451 | 21.8k | Ok(self.push(elem)) | 452 | 21.8k | } |
<alloc::vec::Vec<mp4parse::ItemPropertyAssociationEntry> as fallible_collections::vec::FallibleVec<mp4parse::ItemPropertyAssociationEntry>>::try_push Line | Count | Source | 447 | 38 | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 38 | if self.len() == self.capacity() { | 449 | 18 | self.try_reserve(1)?; | 450 | 20 | } | 451 | 38 | Ok(self.push(elem)) | 452 | 38 | } |
<alloc::vec::Vec<mp4parse::ProtectionSystemSpecificHeaderBox> as fallible_collections::vec::FallibleVec<mp4parse::ProtectionSystemSpecificHeaderBox>>::try_push Line | Count | Source | 447 | 4.85k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 4.85k | if self.len() == self.capacity() { | 449 | 186 | self.try_reserve(1)?; | 450 | 4.66k | } | 451 | 4.85k | Ok(self.push(elem)) | 452 | 4.85k | } |
<alloc::vec::Vec<mp4parse::Edit> as fallible_collections::vec::FallibleVec<mp4parse::Edit>>::try_push Line | Count | Source | 447 | 208k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 208k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 208k | } | 451 | 208k | Ok(self.push(elem)) | 452 | 208k | } |
<alloc::vec::Vec<mp4parse::Track> as fallible_collections::vec::FallibleVec<mp4parse::Track>>::try_push Line | Count | Source | 447 | 48.8k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 48.8k | if self.len() == self.capacity() { | 449 | 1.94k | self.try_reserve(1)?; | 450 | 46.9k | } | 451 | 48.8k | Ok(self.push(elem)) | 452 | 48.8k | } |
<alloc::vec::Vec<mp4parse::Extent> as fallible_collections::vec::FallibleVec<mp4parse::Extent>>::try_push Line | Count | Source | 447 | 1.03M | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 1.03M | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 1.03M | } | 451 | 1.03M | Ok(self.push(elem)) | 452 | 1.03M | } |
<alloc::vec::Vec<mp4parse::ItemId> as fallible_collections::vec::FallibleVec<mp4parse::ItemId>>::try_push Line | Count | Source | 447 | 9 | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 9 | if self.len() == self.capacity() { | 449 | 8 | self.try_reserve(1)?; | 450 | 1 | } | 451 | 9 | Ok(self.push(elem)) | 452 | 9 | } |
<alloc::vec::Vec<mp4parse::Sample> as fallible_collections::vec::FallibleVec<mp4parse::Sample>>::try_push Line | Count | Source | 447 | 28.3k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 28.3k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 28.3k | } | 451 | 28.3k | Ok(self.push(elem)) | 452 | 28.3k | } |
<alloc::vec::Vec<mp4parse::DataBox> as fallible_collections::vec::FallibleVec<mp4parse::DataBox>>::try_push Line | Count | Source | 447 | 22.7k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 22.7k | if self.len() == self.capacity() { | 449 | 164 | self.try_reserve(1)?; | 450 | 22.5k | } | 451 | 22.7k | Ok(self.push(elem)) | 452 | 22.7k | } |
<alloc::vec::Vec<mp4parse_capi::Mp4parseTrackAudioSampleInfo> as fallible_collections::vec::FallibleVec<mp4parse_capi::Mp4parseTrackAudioSampleInfo>>::try_push Line | Count | Source | 447 | 13.7k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 13.7k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 13.7k | } | 451 | 13.7k | Ok(self.push(elem)) | 452 | 13.7k | } |
<alloc::vec::Vec<mp4parse_capi::Mp4parseTrackVideoSampleInfo> as fallible_collections::vec::FallibleVec<mp4parse_capi::Mp4parseTrackVideoSampleInfo>>::try_push Line | Count | Source | 447 | 5.80k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 5.80k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 5.80k | } | 451 | 5.80k | Ok(self.push(elem)) | 452 | 5.80k | } |
<alloc::vec::Vec<mp4parse::boxes::FourCC> as fallible_collections::vec::FallibleVec<mp4parse::boxes::FourCC>>::try_push Line | Count | Source | 447 | 279k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 279k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 279k | } | 451 | 279k | Ok(self.push(elem)) | 452 | 279k | } |
<alloc::vec::Vec<(u8, u32)> as fallible_collections::vec::FallibleVec<(u8, u32)>>::try_push Line | Count | Source | 447 | 18 | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 18 | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 18 | } | 451 | 18 | Ok(self.push(elem)) | 452 | 18 | } |
<alloc::vec::Vec<u32> as fallible_collections::vec::FallibleVec<u32>>::try_push Line | Count | Source | 447 | 217k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 217k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 217k | } | 451 | 217k | Ok(self.push(elem)) | 452 | 217k | } |
<alloc::vec::Vec<u64> as fallible_collections::vec::FallibleVec<u64>>::try_push Line | Count | Source | 447 | 415k | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 415k | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 415k | } | 451 | 415k | Ok(self.push(elem)) | 452 | 415k | } |
<alloc::vec::Vec<mp4parse::unstable::Indice> as fallible_collections::vec::FallibleVec<mp4parse::unstable::Indice>>::try_push Line | Count | Source | 447 | 59.3M | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 59.3M | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 59.3M | } | 451 | 59.3M | Ok(self.push(elem)) | 452 | 59.3M | } |
<alloc::vec::Vec<&mp4parse::ItemProperty> as fallible_collections::vec::FallibleVec<&mp4parse::ItemProperty>>::try_push Line | Count | Source | 447 | 57 | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 57 | if self.len() == self.capacity() { | 449 | 57 | self.try_reserve(1)?; | 450 | 0 | } | 451 | 57 | Ok(self.push(elem)) | 452 | 57 | } |
<alloc::vec::Vec<usize> as fallible_collections::vec::FallibleVec<usize>>::try_push Line | Count | Source | 447 | 59.3M | fn try_push(&mut self, elem: T) -> Result<(), TryReserveError> { | 448 | 59.3M | if self.len() == self.capacity() { | 449 | 0 | self.try_reserve(1)?; | 450 | 59.3M | } | 451 | 59.3M | Ok(self.push(elem)) | 452 | 59.3M | } |
Unexecuted instantiation: <alloc::vec::Vec<_> as fallible_collections::vec::FallibleVec<_>>::try_push |
453 | | |
454 | | #[inline] |
455 | 0 | fn try_push_give_back(&mut self, elem: T) -> Result<(), (T, TryReserveError)> { |
456 | 0 | if self.len() == self.capacity() { |
457 | 0 | if let Err(e) = self.try_reserve(1) { |
458 | 0 | return Err((elem, e)); |
459 | 0 | } |
460 | 0 | } |
461 | 0 | Ok(self.push(elem)) |
462 | 0 | } |
463 | | |
464 | | #[inline] |
465 | 158k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> |
466 | 158k | where |
467 | 158k | Self: core::marker::Sized, |
468 | | { |
469 | 158k | let mut n = Self::new(); |
470 | 158k | FallibleVec::try_reserve(&mut n, capacity)?; |
471 | 158k | Ok(n) |
472 | 158k | } <alloc::vec::Vec<mp4parse::TimeOffset> as fallible_collections::vec::FallibleVec<mp4parse::TimeOffset>>::try_with_capacity Line | Count | Source | 465 | 1.38k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 1.38k | where | 467 | 1.38k | Self: core::marker::Sized, | 468 | | { | 469 | 1.38k | let mut n = Self::new(); | 470 | 1.38k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 1.38k | Ok(n) | 472 | 1.38k | } |
<alloc::vec::Vec<mp4parse::Association> as fallible_collections::vec::FallibleVec<mp4parse::Association>>::try_with_capacity Line | Count | Source | 465 | 19 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 19 | where | 467 | 19 | Self: core::marker::Sized, | 468 | | { | 469 | 19 | let mut n = Self::new(); | 470 | 19 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 19 | Ok(n) | 472 | 19 | } |
<alloc::vec::Vec<mp4parse::SampleEntry> as fallible_collections::vec::FallibleVec<mp4parse::SampleEntry>>::try_with_capacity Line | Count | Source | 465 | 32.2k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 32.2k | where | 467 | 32.2k | Self: core::marker::Sized, | 468 | | { | 469 | 32.2k | let mut n = Self::new(); | 470 | 32.2k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 32.2k | Ok(n) | 472 | 32.2k | } |
<alloc::vec::Vec<mp4parse::ItemInfoEntry> as fallible_collections::vec::FallibleVec<mp4parse::ItemInfoEntry>>::try_with_capacity Line | Count | Source | 465 | 19 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 19 | where | 467 | 19 | Self: core::marker::Sized, | 468 | | { | 469 | 19 | let mut n = Self::new(); | 470 | 19 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 19 | Ok(n) | 472 | 19 | } |
<alloc::vec::Vec<mp4parse::SampleToChunk> as fallible_collections::vec::FallibleVec<mp4parse::SampleToChunk>>::try_with_capacity Line | Count | Source | 465 | 30.6k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 30.6k | where | 467 | 30.6k | Self: core::marker::Sized, | 468 | | { | 469 | 30.6k | let mut n = Self::new(); | 470 | 30.6k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 30.6k | Ok(n) | 472 | 30.6k | } |
<alloc::vec::Vec<mp4parse::TrackReferenceEntry> as fallible_collections::vec::FallibleVec<mp4parse::TrackReferenceEntry>>::try_with_capacity Line | Count | Source | 465 | 2.39k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 2.39k | where | 467 | 2.39k | Self: core::marker::Sized, | 468 | | { | 469 | 2.39k | let mut n = Self::new(); | 470 | 2.39k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 2.39k | Ok(n) | 472 | 2.39k | } |
<alloc::vec::Vec<mp4parse::ItemPropertyAssociationEntry> as fallible_collections::vec::FallibleVec<mp4parse::ItemPropertyAssociationEntry>>::try_with_capacity Line | Count | Source | 465 | 18 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 18 | where | 467 | 18 | Self: core::marker::Sized, | 468 | | { | 469 | 18 | let mut n = Self::new(); | 470 | 18 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 18 | Ok(n) | 472 | 18 | } |
<alloc::vec::Vec<mp4parse::Edit> as fallible_collections::vec::FallibleVec<mp4parse::Edit>>::try_with_capacity Line | Count | Source | 465 | 10.2k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 10.2k | where | 467 | 10.2k | Self: core::marker::Sized, | 468 | | { | 469 | 10.2k | let mut n = Self::new(); | 470 | 10.2k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 10.2k | Ok(n) | 472 | 10.2k | } |
<alloc::vec::Vec<mp4parse::Extent> as fallible_collections::vec::FallibleVec<mp4parse::Extent>>::try_with_capacity Line | Count | Source | 465 | 67 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 67 | where | 467 | 67 | Self: core::marker::Sized, | 468 | | { | 469 | 67 | let mut n = Self::new(); | 470 | 67 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 67 | Ok(n) | 472 | 67 | } |
<alloc::vec::Vec<mp4parse::Sample> as fallible_collections::vec::FallibleVec<mp4parse::Sample>>::try_with_capacity Line | Count | Source | 465 | 20.8k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 20.8k | where | 467 | 20.8k | Self: core::marker::Sized, | 468 | | { | 469 | 20.8k | let mut n = Self::new(); | 470 | 20.8k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 20.8k | Ok(n) | 472 | 20.8k | } |
<alloc::vec::Vec<mp4parse_capi::Mp4parseTrackAudioSampleInfo> as fallible_collections::vec::FallibleVec<mp4parse_capi::Mp4parseTrackAudioSampleInfo>>::try_with_capacity Line | Count | Source | 465 | 15.1k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 15.1k | where | 467 | 15.1k | Self: core::marker::Sized, | 468 | | { | 469 | 15.1k | let mut n = Self::new(); | 470 | 15.1k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 15.1k | Ok(n) | 472 | 15.1k | } |
<alloc::vec::Vec<mp4parse_capi::Mp4parseTrackVideoSampleInfo> as fallible_collections::vec::FallibleVec<mp4parse_capi::Mp4parseTrackVideoSampleInfo>>::try_with_capacity Line | Count | Source | 465 | 5.39k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 5.39k | where | 467 | 5.39k | Self: core::marker::Sized, | 468 | | { | 469 | 5.39k | let mut n = Self::new(); | 470 | 5.39k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 5.39k | Ok(n) | 472 | 5.39k | } |
<alloc::vec::Vec<mp4parse::boxes::FourCC> as fallible_collections::vec::FallibleVec<mp4parse::boxes::FourCC>>::try_with_capacity Line | Count | Source | 465 | 5.51k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 5.51k | where | 467 | 5.51k | Self: core::marker::Sized, | 468 | | { | 469 | 5.51k | let mut n = Self::new(); | 470 | 5.51k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 5.51k | Ok(n) | 472 | 5.51k | } |
<alloc::vec::Vec<(u8, u32)> as fallible_collections::vec::FallibleVec<(u8, u32)>>::try_with_capacity Line | Count | Source | 465 | 18 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 18 | where | 467 | 18 | Self: core::marker::Sized, | 468 | | { | 469 | 18 | let mut n = Self::new(); | 470 | 18 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 18 | Ok(n) | 472 | 18 | } |
<alloc::vec::Vec<u32> as fallible_collections::vec::FallibleVec<u32>>::try_with_capacity Line | Count | Source | 465 | 5.40k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 5.40k | where | 467 | 5.40k | Self: core::marker::Sized, | 468 | | { | 469 | 5.40k | let mut n = Self::new(); | 470 | 5.40k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 5.40k | Ok(n) | 472 | 5.40k | } |
<alloc::vec::Vec<u64> as fallible_collections::vec::FallibleVec<u64>>::try_with_capacity Line | Count | Source | 465 | 28.5k | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 28.5k | where | 467 | 28.5k | Self: core::marker::Sized, | 468 | | { | 469 | 28.5k | let mut n = Self::new(); | 470 | 28.5k | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 28.5k | Ok(n) | 472 | 28.5k | } |
<alloc::vec::Vec<mp4parse::unstable::Indice> as fallible_collections::vec::FallibleVec<mp4parse::unstable::Indice>>::try_with_capacity Line | Count | Source | 465 | 358 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 358 | where | 467 | 358 | Self: core::marker::Sized, | 468 | | { | 469 | 358 | let mut n = Self::new(); | 470 | 358 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 357 | Ok(n) | 472 | 358 | } |
<alloc::vec::Vec<usize> as fallible_collections::vec::FallibleVec<usize>>::try_with_capacity Line | Count | Source | 465 | 54 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 54 | where | 467 | 54 | Self: core::marker::Sized, | 468 | | { | 469 | 54 | let mut n = Self::new(); | 470 | 54 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 54 | Ok(n) | 472 | 54 | } |
<alloc::vec::Vec<u8> as fallible_collections::vec::FallibleVec<u8>>::try_with_capacity Line | Count | Source | 465 | 224 | fn try_with_capacity(capacity: usize) -> Result<Self, TryReserveError> | 466 | 224 | where | 467 | 224 | Self: core::marker::Sized, | 468 | | { | 469 | 224 | let mut n = Self::new(); | 470 | 224 | FallibleVec::try_reserve(&mut n, capacity)?; | 471 | 224 | Ok(n) | 472 | 224 | } |
|
473 | | |
474 | | #[inline] |
475 | 0 | fn try_insert(&mut self, index: usize, element: T) -> Result<(), (T, TryReserveError)> { |
476 | 0 | if self.len() == self.capacity() { |
477 | 0 | if let Err(e) = self.try_reserve(1) { |
478 | 0 | return Err((element, e)); |
479 | 0 | } |
480 | 0 | } |
481 | 0 | Ok(self.insert(index, element)) |
482 | 0 | } |
483 | | |
484 | | #[inline] |
485 | 4.85k | fn try_append(&mut self, other: &mut Self) -> Result<(), TryReserveError> { |
486 | 4.85k | FallibleVec::try_reserve(self, other.len())?; |
487 | 4.85k | Ok(self.append(other)) |
488 | 4.85k | } <alloc::vec::Vec<u8> as fallible_collections::vec::FallibleVec<u8>>::try_append Line | Count | Source | 485 | 4.85k | fn try_append(&mut self, other: &mut Self) -> Result<(), TryReserveError> { | 486 | 4.85k | FallibleVec::try_reserve(self, other.len())?; | 487 | 4.85k | Ok(self.append(other)) | 488 | 4.85k | } |
Unexecuted instantiation: <alloc::vec::Vec<_> as fallible_collections::vec::FallibleVec<_>>::try_append |
489 | | |
490 | 0 | fn try_resize(&mut self, new_len: usize, value: T) -> Result<(), TryReserveError> |
491 | 0 | where |
492 | 0 | T: Copy + Clone, |
493 | | { |
494 | 0 | let len = self.len(); |
495 | 0 | if new_len > len { |
496 | 0 | FallibleVec::try_reserve(self, new_len - len)?; |
497 | 0 | } |
498 | 0 | Ok(self.resize(new_len, value)) |
499 | 0 | } |
500 | | |
501 | 0 | fn try_resize_with<F>(&mut self, new_len: usize, f: F) -> Result<(), TryReserveError> |
502 | 0 | where |
503 | 0 | F: FnMut() -> T, |
504 | | { |
505 | 0 | let len = self.len(); |
506 | 0 | if new_len > len { |
507 | 0 | FallibleVec::try_reserve(self, new_len - len)?; |
508 | 0 | } |
509 | 0 | Ok(self.resize_with(new_len, f)) |
510 | 0 | } |
511 | | |
512 | 0 | fn try_resize_no_copy(&mut self, new_len: usize, value: T) -> Result<(), TryReserveError> |
513 | 0 | where |
514 | 0 | T: TryClone, |
515 | | { |
516 | 0 | let len = self.len(); |
517 | | |
518 | 0 | if new_len > len { |
519 | 0 | self.try_extend_with(new_len - len, TryExtendElement(value)) |
520 | | } else { |
521 | 0 | Ok(Truncate::truncate(self, new_len)) |
522 | | } |
523 | 0 | } |
524 | | |
525 | | #[inline] |
526 | 0 | fn try_extend_from_slice(&mut self, other: &[T]) -> Result<(), TryReserveError> |
527 | 0 | where |
528 | 0 | T: Clone, |
529 | | { |
530 | 0 | if needs_to_grow(self, other.len()) { |
531 | 0 | self.try_reserve(other.len())?; |
532 | 0 | } |
533 | 0 | Ok(self.extend_from_slice(other)) |
534 | 0 | } |
535 | | |
536 | 115k | fn try_extend_from_slice_no_copy(&mut self, other: &[T]) -> Result<(), TryReserveError> |
537 | 115k | where |
538 | 115k | T: TryClone, |
539 | | { |
540 | 115k | if needs_to_grow(self, other.len()) { |
541 | 53.9k | self.try_reserve(other.len())?; |
542 | 61.7k | } |
543 | 115k | let mut len = self.len(); |
544 | 115k | let mut iterator = other.iter(); |
545 | 5.38M | while let Some(element) = iterator.next() { |
546 | | unsafe { |
547 | 5.26M | core::ptr::write(self.as_mut_ptr().add(len), element.try_clone()?); |
548 | | // NB can't overflow since we would have had to alloc the address space |
549 | 5.26M | len += 1; |
550 | 5.26M | self.set_len(len); |
551 | | } |
552 | | } |
553 | 115k | Ok(()) |
554 | 115k | } |
555 | | } |
556 | | |
557 | | trait ExtendWith<T> { |
558 | | fn next(&mut self) -> Result<T, TryReserveError>; |
559 | | fn last(self) -> T; |
560 | | } |
561 | | |
562 | | struct TryExtendElement<T: TryClone>(T); |
563 | | impl<T: TryClone> ExtendWith<T> for TryExtendElement<T> { |
564 | | #[inline(always)] |
565 | 0 | fn next(&mut self) -> Result<T, TryReserveError> { |
566 | 0 | self.0.try_clone() |
567 | 0 | } |
568 | | #[inline(always)] |
569 | 0 | fn last(self) -> T { |
570 | 0 | self.0 |
571 | 0 | } |
572 | | } |
573 | | |
574 | | trait TryExtend<T> { |
575 | | fn try_extend_with<E: ExtendWith<T>>( |
576 | | &mut self, |
577 | | n: usize, |
578 | | value: E, |
579 | | ) -> Result<(), TryReserveError>; |
580 | | } |
581 | | |
582 | | impl<T> TryExtend<T> for Vec<T> { |
583 | | /// Extend the vector by `n` values, using the given generator. |
584 | 0 | fn try_extend_with<E: ExtendWith<T>>( |
585 | 0 | &mut self, |
586 | 0 | n: usize, |
587 | 0 | mut value: E, |
588 | 0 | ) -> Result<(), TryReserveError> { |
589 | 0 | if needs_to_grow(self, n) { |
590 | 0 | self.try_reserve(n)?; |
591 | 0 | } |
592 | | |
593 | | unsafe { |
594 | 0 | let mut ptr = self.as_mut_ptr().add(self.len()); |
595 | | |
596 | 0 | let mut local_len = self.len(); |
597 | | // Write all elements except the last one |
598 | 0 | for _ in 1..n { |
599 | 0 | core::ptr::write(ptr, value.next()?); |
600 | 0 | ptr = ptr.offset(1); |
601 | | // Increment the length in every step in case next() panics |
602 | 0 | local_len += 1; |
603 | 0 | self.set_len(local_len); |
604 | | } |
605 | | |
606 | 0 | if n > 0 { |
607 | 0 | // We can write the last element directly without cloning needlessly |
608 | 0 | core::ptr::write(ptr, value.last()); |
609 | 0 | local_len += 1; |
610 | 0 | self.set_len(local_len); |
611 | 0 | } |
612 | | |
613 | | // len set by scope guard |
614 | | } |
615 | 0 | Ok(()) |
616 | 0 | } |
617 | | } |
618 | | |
619 | | trait Truncate { |
620 | | fn truncate(&mut self, len: usize); |
621 | | } |
622 | | |
623 | | impl<T> Truncate for Vec<T> { |
624 | 0 | fn truncate(&mut self, len: usize) { |
625 | 0 | let current_len = self.len(); |
626 | | unsafe { |
627 | 0 | let mut ptr = self.as_mut_ptr().add(current_len); |
628 | | // Set the final length at the end, keeping in mind that |
629 | | // dropping an element might panic. Works around a missed |
630 | | // optimization, as seen in the following issue: |
631 | | // https://github.com/rust-lang/rust/issues/51802 |
632 | 0 | let mut local_len = self.len(); |
633 | | |
634 | | // drop any extra elements |
635 | 0 | for _ in len..current_len { |
636 | 0 | ptr = ptr.offset(-1); |
637 | 0 | core::ptr::drop_in_place(ptr); |
638 | 0 | local_len -= 1; |
639 | 0 | self.set_len(local_len); |
640 | 0 | } |
641 | | } |
642 | 0 | } |
643 | | } |
644 | | |
645 | | /// try creating a vec from an `elem` cloned `n` times, see std::from_elem |
646 | | #[cfg(feature = "unstable")] |
647 | | pub fn try_from_elem<T: TryClone>(elem: T, n: usize) -> Result<Vec<T>, TryReserveError> { |
648 | | <T as SpecFromElem>::try_from_elem(elem, n) |
649 | | } |
650 | | |
651 | | // Specialization trait used for Vec::from_elem |
652 | | #[cfg(feature = "unstable")] |
653 | | trait SpecFromElem: Sized { |
654 | | fn try_from_elem(elem: Self, n: usize) -> Result<Vec<Self>, TryReserveError>; |
655 | | } |
656 | | |
657 | | #[cfg(feature = "unstable")] |
658 | | impl<T: TryClone> SpecFromElem for T { |
659 | | default fn try_from_elem(elem: Self, n: usize) -> Result<Vec<T>, TryReserveError> { |
660 | | let mut v = Vec::new(); |
661 | | v.try_resize_no_copy(n, elem)?; |
662 | | Ok(v) |
663 | | } |
664 | | } |
665 | | |
666 | | #[cfg(feature = "unstable")] |
667 | | impl SpecFromElem for u8 { |
668 | | #[inline] |
669 | | fn try_from_elem(elem: u8, n: usize) -> Result<Vec<u8>, TryReserveError> { |
670 | | unsafe { |
671 | | let mut v: Vec<u8> = FallibleVec::try_with_capacity(n)?; |
672 | | core::ptr::write_bytes(v.as_mut_ptr(), elem, n); |
673 | | v.set_len(n); |
674 | | Ok(v) |
675 | | } |
676 | | } |
677 | | } |
678 | | |
679 | | impl<T: TryClone> TryClone for Vec<T> { |
680 | | #[inline] |
681 | 0 | fn try_clone(&self) -> Result<Self, TryReserveError> |
682 | 0 | where |
683 | 0 | Self: core::marker::Sized, |
684 | | { |
685 | 0 | let mut v = Vec::new(); |
686 | 0 | v.try_extend_from_slice_no_copy(self)?; |
687 | 0 | Ok(v) |
688 | 0 | } |
689 | | } |
690 | | |
691 | | pub trait TryFromIterator<I>: Sized { |
692 | | fn try_from_iterator<T: IntoIterator<Item = I>>(iterator: T) -> Result<Self, TryReserveError>; |
693 | | } |
694 | | |
695 | | impl<I> TryFromIterator<I> for Vec<I> { |
696 | 0 | fn try_from_iterator<T: IntoIterator<Item = I>>(iterator: T) -> Result<Self, TryReserveError> |
697 | 0 | where |
698 | 0 | T: IntoIterator<Item = I>, |
699 | | { |
700 | 0 | let mut new = Self::new(); |
701 | 0 | for i in iterator { |
702 | 0 | new.try_push(i)?; |
703 | | } |
704 | 0 | Ok(new) |
705 | 0 | } |
706 | | } |
707 | | |
708 | | pub trait TryCollect<I> { |
709 | | fn try_collect<C: TryFromIterator<I>>(self) -> Result<C, TryReserveError>; |
710 | | } |
711 | | |
712 | | impl<I, T> TryCollect<I> for T |
713 | | where |
714 | | T: IntoIterator<Item = I>, |
715 | | { |
716 | | #[inline(always)] |
717 | 0 | fn try_collect<C: TryFromIterator<I>>(self) -> Result<C, TryReserveError> { |
718 | 0 | C::try_from_iterator(self) |
719 | 0 | } |
720 | | } |
721 | | |
722 | | #[cfg(test)] |
723 | | mod tests { |
724 | | use super::*; |
725 | | |
726 | | #[test] |
727 | | #[cfg(feature = "unstable")] |
728 | | fn vec() { |
729 | | // let v: Vec<u8> = from_elem(1, 10); |
730 | | let v: Vec<Vec<u8>> = try_vec![try_vec![42; 10].unwrap(); 100].unwrap(); |
731 | | println!("{:?}", v); |
732 | | let v2 = try_vec![0, 1, 2]; |
733 | | println!("{:?}", v2); |
734 | | assert_eq!(2 + 2, 4); |
735 | | } |
736 | | |
737 | | #[test] |
738 | | fn try_clone_vec() { |
739 | | // let v: Vec<u8> = from_elem(1, 10); |
740 | | let v = vec![42; 100]; |
741 | | assert_eq!(v.try_clone().unwrap(), v); |
742 | | } |
743 | | |
744 | | #[test] |
745 | | fn try_clone_oom() { |
746 | | let layout = Layout::new::<u8>(); |
747 | | let v = unsafe { |
748 | | Vec::<u8>::from_raw_parts( |
749 | | alloc(layout), |
750 | | core::isize::MAX as usize, |
751 | | core::isize::MAX as usize, |
752 | | ) |
753 | | }; |
754 | | assert!(v.try_clone().is_err()); |
755 | | } |
756 | | |
757 | | #[test] |
758 | | fn tryvec_try_clone_oom() { |
759 | | let layout = Layout::new::<u8>(); |
760 | | let inner = unsafe { |
761 | | Vec::<u8>::from_raw_parts( |
762 | | alloc(layout), |
763 | | core::isize::MAX as usize, |
764 | | core::isize::MAX as usize, |
765 | | ) |
766 | | }; |
767 | | let tv = TryVec { inner }; |
768 | | assert!(tv.try_clone().is_err()); |
769 | | } |
770 | | |
771 | | // #[test] |
772 | | // fn try_out_of_mem() { |
773 | | // let v = try_vec![42_u8; 1000000000]; |
774 | | // assert_eq!(v.try_clone().unwrap(), v); |
775 | | // } |
776 | | |
777 | | #[test] |
778 | | fn oom() { |
779 | | let mut vec: Vec<char> = Vec::new(); |
780 | | match FallibleVec::try_reserve(&mut vec, core::usize::MAX / std::mem::size_of::<char>()) { |
781 | | Ok(_) => panic!("it should be OOM"), |
782 | | _ => (), |
783 | | } |
784 | | match FallibleVec::try_reserve(&mut vec, core::usize::MAX) { |
785 | | Ok(_) => panic!("it should be OOM"), |
786 | | _ => (), |
787 | | } |
788 | | } |
789 | | |
790 | | #[test] |
791 | | fn tryvec_oom() { |
792 | | let mut vec: TryVec<char> = TryVec::new(); |
793 | | match vec.reserve(core::usize::MAX / std::mem::size_of::<char>()) { |
794 | | Ok(_) => panic!("it should be OOM"), |
795 | | _ => (), |
796 | | } |
797 | | match vec.reserve(core::usize::MAX) { |
798 | | Ok(_) => panic!("it should be OOM"), |
799 | | _ => (), |
800 | | } |
801 | | } |
802 | | |
803 | | #[test] |
804 | | fn try_reserve() { |
805 | | let mut vec: Vec<_> = vec![1]; |
806 | | let additional_room = vec.capacity() - vec.len(); |
807 | | let additional = additional_room + 1; |
808 | | let old_cap = vec.capacity(); |
809 | | FallibleVec::try_reserve(&mut vec, additional).unwrap(); |
810 | | assert!(vec.capacity() > old_cap); |
811 | | } |
812 | | |
813 | | #[test] |
814 | | fn tryvec_reserve() { |
815 | | let mut vec: TryVec<_> = vec![1].into(); |
816 | | let old_cap = vec.inner.capacity(); |
817 | | let new_cap = old_cap + 1; |
818 | | vec.reserve(new_cap).unwrap(); |
819 | | assert!(vec.inner.capacity() >= new_cap); |
820 | | } |
821 | | |
822 | | #[test] |
823 | | fn try_reserve_idempotent() { |
824 | | let mut vec: Vec<_> = vec![1]; |
825 | | let additional_room = vec.capacity() - vec.len(); |
826 | | let additional = additional_room + 1; |
827 | | FallibleVec::try_reserve(&mut vec, additional).unwrap(); |
828 | | let cap_after_reserve = vec.capacity(); |
829 | | FallibleVec::try_reserve(&mut vec, additional).unwrap(); |
830 | | assert_eq!(vec.capacity(), cap_after_reserve); |
831 | | } |
832 | | |
833 | | #[test] |
834 | | fn tryvec_reserve_idempotent() { |
835 | | let mut vec: TryVec<_> = vec![1].into(); |
836 | | let old_cap = vec.inner.capacity(); |
837 | | let new_cap = old_cap + 1; |
838 | | vec.reserve(new_cap).unwrap(); |
839 | | let cap_after_reserve = vec.inner.capacity(); |
840 | | vec.reserve(new_cap).unwrap(); |
841 | | assert_eq!(cap_after_reserve, vec.inner.capacity()); |
842 | | } |
843 | | |
844 | | #[test] |
845 | | fn capacity_overflow() { |
846 | | let mut vec: Vec<_> = vec![1]; |
847 | | match FallibleVec::try_reserve(&mut vec, core::usize::MAX) { |
848 | | Ok(_) => panic!("capacity calculation should overflow"), |
849 | | _ => (), |
850 | | } |
851 | | } |
852 | | |
853 | | #[test] |
854 | | fn tryvec_capacity_overflow() { |
855 | | let mut vec: TryVec<_> = vec![1].into(); |
856 | | match vec.reserve(core::usize::MAX) { |
857 | | Ok(_) => panic!("capacity calculation should overflow"), |
858 | | _ => (), |
859 | | } |
860 | | } |
861 | | |
862 | | #[test] |
863 | | fn extend_from_slice() { |
864 | | let mut vec: Vec<u8> = b"foo".as_ref().into(); |
865 | | vec.shrink_to_fit(); |
866 | | vec.reserve(5); |
867 | | assert_eq!(8, vec.capacity()); |
868 | | vec.try_extend_from_slice(b"bar").unwrap(); |
869 | | assert_eq!(vec, b"foobar".as_ref()); |
870 | | vec.try_extend_from_slice(b"1").unwrap(); |
871 | | assert_eq!(vec, b"foobar1".as_ref()); |
872 | | assert_eq!(8, vec.capacity()); |
873 | | vec.try_extend_from_slice(b"11").unwrap(); |
874 | | assert_eq!(16, vec.capacity()); |
875 | | } |
876 | | |
877 | | #[test] |
878 | | fn tryvec_extend_from_slice() { |
879 | | let mut vec: TryVec<u8> = b"foo".as_ref().try_into().unwrap(); |
880 | | vec.extend_from_slice(b"bar").unwrap(); |
881 | | assert_eq!(vec, b"foobar".as_ref()); |
882 | | } |
883 | | |
884 | | #[test] |
885 | | fn try_reserve_zst() { |
886 | | let mut vec: Vec<()> = Vec::new(); |
887 | | assert!(FallibleVec::try_reserve(&mut vec, core::usize::MAX).is_ok()); |
888 | | } |
889 | | } |