/rust/registry/src/index.crates.io-1949cf8c6b5b557f/alloc-stdlib-0.2.2/src/heap_alloc.rs
Line | Count | Source |
1 | | use std; |
2 | | |
3 | | |
4 | | use super::{SliceWrapper, SliceWrapperMut, Allocator}; |
5 | | |
6 | | use std::ops; |
7 | | use std::ops::Range; |
8 | | use std::boxed::Box; |
9 | | use std::vec::Vec; |
10 | | pub struct WrapBox<T>(std::boxed::Box<[T]>); |
11 | | |
12 | | impl<T> From<Vec<T>> for WrapBox<T> { |
13 | 1.84M | fn from(data: Vec<T>) -> Self { |
14 | 1.84M | WrapBox(data.into_boxed_slice()) |
15 | 1.84M | } Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>> as core::convert::From<alloc::vec::Vec<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>>>>::from <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::entropy_encode::HuffmanTree> as core::convert::From<alloc::vec::Vec<brotli::enc::entropy_encode::HuffmanTree>>>::from Line | Count | Source | 13 | 41.8k | fn from(data: Vec<T>) -> Self { | 14 | 41.8k | WrapBox(data.into_boxed_slice()) | 15 | 41.8k | } |
Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::compat::Compat16x16> as core::convert::From<alloc::vec::Vec<brotli::enc::compat::Compat16x16>>>::from <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::compat::CompatF8> as core::convert::From<alloc::vec::Vec<brotli::enc::compat::CompatF8>>>::from Line | Count | Source | 13 | 6.66k | fn from(data: Vec<T>) -> Self { | 14 | 6.66k | WrapBox(data.into_boxed_slice()) | 15 | 6.66k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::cluster::HistogramPair> as core::convert::From<alloc::vec::Vec<brotli::enc::cluster::HistogramPair>>>::from Line | Count | Source | 13 | 20.5k | fn from(data: Vec<T>) -> Self { | 14 | 20.5k | WrapBox(data.into_boxed_slice()) | 15 | 20.5k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::command::Command> as core::convert::From<alloc::vec::Vec<brotli::enc::command::Command>>>::from Line | Count | Source | 13 | 11.1k | fn from(data: Vec<T>) -> Self { | 14 | 11.1k | WrapBox(data.into_boxed_slice()) | 15 | 11.1k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::ContextType> as core::convert::From<alloc::vec::Vec<brotli::enc::histogram::ContextType>>>::from Line | Count | Source | 13 | 6.57k | fn from(data: Vec<T>) -> Self { | 14 | 6.57k | WrapBox(data.into_boxed_slice()) | 15 | 6.57k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramCommand> as core::convert::From<alloc::vec::Vec<brotli::enc::histogram::HistogramCommand>>>::from Line | Count | Source | 13 | 16.4k | fn from(data: Vec<T>) -> Self { | 14 | 16.4k | WrapBox(data.into_boxed_slice()) | 15 | 16.4k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramLiteral> as core::convert::From<alloc::vec::Vec<brotli::enc::histogram::HistogramLiteral>>>::from Line | Count | Source | 13 | 37.2k | fn from(data: Vec<T>) -> Self { | 14 | 37.2k | WrapBox(data.into_boxed_slice()) | 15 | 37.2k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramDistance> as core::convert::From<alloc::vec::Vec<brotli::enc::histogram::HistogramDistance>>>::from Line | Count | Source | 13 | 28.4k | fn from(data: Vec<T>) -> Self { | 14 | 28.4k | WrapBox(data.into_boxed_slice()) | 15 | 28.4k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode> as core::convert::From<alloc::vec::Vec<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode>>>::from Line | Count | Source | 13 | 7.39k | fn from(data: Vec<T>) -> Self { | 14 | 7.39k | WrapBox(data.into_boxed_slice()) | 15 | 7.39k | } |
<alloc_stdlib::heap_alloc::WrapBox<f32> as core::convert::From<alloc::vec::Vec<f32>>>::from Line | Count | Source | 13 | 21.4k | fn from(data: Vec<T>) -> Self { | 14 | 21.4k | WrapBox(data.into_boxed_slice()) | 15 | 21.4k | } |
<alloc_stdlib::heap_alloc::WrapBox<i32> as core::convert::From<alloc::vec::Vec<i32>>>::from Line | Count | Source | 13 | 644 | fn from(data: Vec<T>) -> Self { | 14 | 644 | WrapBox(data.into_boxed_slice()) | 15 | 644 | } |
<alloc_stdlib::heap_alloc::WrapBox<u16> as core::convert::From<alloc::vec::Vec<u16>>>::from Line | Count | Source | 13 | 55.7k | fn from(data: Vec<T>) -> Self { | 14 | 55.7k | WrapBox(data.into_boxed_slice()) | 15 | 55.7k | } |
<alloc_stdlib::heap_alloc::WrapBox<u64> as core::convert::From<alloc::vec::Vec<u64>>>::from Line | Count | Source | 13 | 8.22k | fn from(data: Vec<T>) -> Self { | 14 | 8.22k | WrapBox(data.into_boxed_slice()) | 15 | 8.22k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli_decompressor::huffman::HuffmanCode> as core::convert::From<alloc::vec::Vec<brotli_decompressor::huffman::HuffmanCode>>>::from Line | Count | Source | 13 | 203k | fn from(data: Vec<T>) -> Self { | 14 | 203k | WrapBox(data.into_boxed_slice()) | 15 | 203k | } |
<alloc_stdlib::heap_alloc::WrapBox<u8> as core::convert::From<alloc::vec::Vec<u8>>>::from Line | Count | Source | 13 | 692k | fn from(data: Vec<T>) -> Self { | 14 | 692k | WrapBox(data.into_boxed_slice()) | 15 | 692k | } |
<alloc_stdlib::heap_alloc::WrapBox<u32> as core::convert::From<alloc::vec::Vec<u32>>>::from Line | Count | Source | 13 | 684k | fn from(data: Vec<T>) -> Self { | 14 | 684k | WrapBox(data.into_boxed_slice()) | 15 | 684k | } |
|
16 | | } |
17 | | |
18 | | impl<T> Into<Box<[T]>> for WrapBox<T> { |
19 | | fn into(self) -> Box<[T]> { |
20 | | self.0 |
21 | | } |
22 | | } |
23 | | |
24 | | impl<T> Default for WrapBox<T> { |
25 | 53.0M | fn default() -> Self { |
26 | 53.0M | let v : std::vec::Vec<T> = std::vec::Vec::new(); |
27 | 53.0M | let b = v.into_boxed_slice(); |
28 | 53.0M | return WrapBox::<T>(b); |
29 | 53.0M | } Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>> as core::default::Default>::default <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::entropy_encode::HuffmanTree> as core::default::Default>::default Line | Count | Source | 25 | 41.8k | fn default() -> Self { | 26 | 41.8k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 41.8k | let b = v.into_boxed_slice(); | 28 | 41.8k | return WrapBox::<T>(b); | 29 | 41.8k | } |
Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::compat::Compat16x16> as core::default::Default>::default Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::compat::CompatF8> as core::default::Default>::default <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::cluster::HistogramPair> as core::default::Default>::default Line | Count | Source | 25 | 6.66k | fn default() -> Self { | 26 | 6.66k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 6.66k | let b = v.into_boxed_slice(); | 28 | 6.66k | return WrapBox::<T>(b); | 29 | 6.66k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::command::Command> as core::default::Default>::default Line | Count | Source | 25 | 25.2k | fn default() -> Self { | 26 | 25.2k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 25.2k | let b = v.into_boxed_slice(); | 28 | 25.2k | return WrapBox::<T>(b); | 29 | 25.2k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::ContextType> as core::default::Default>::default Line | Count | Source | 25 | 6.57k | fn default() -> Self { | 26 | 6.57k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 6.57k | let b = v.into_boxed_slice(); | 28 | 6.57k | return WrapBox::<T>(b); | 29 | 6.57k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramCommand> as core::default::Default>::default Line | Count | Source | 25 | 25.3k | fn default() -> Self { | 26 | 25.3k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 25.3k | let b = v.into_boxed_slice(); | 28 | 25.3k | return WrapBox::<T>(b); | 29 | 25.3k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramLiteral> as core::default::Default>::default Line | Count | Source | 25 | 28.3k | fn default() -> Self { | 26 | 28.3k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 28.3k | let b = v.into_boxed_slice(); | 28 | 28.3k | return WrapBox::<T>(b); | 29 | 28.3k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramDistance> as core::default::Default>::default Line | Count | Source | 25 | 24.6k | fn default() -> Self { | 26 | 24.6k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 24.6k | let b = v.into_boxed_slice(); | 28 | 24.6k | return WrapBox::<T>(b); | 29 | 24.6k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode> as core::default::Default>::default Line | Count | Source | 25 | 348 | fn default() -> Self { | 26 | 348 | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 348 | let b = v.into_boxed_slice(); | 28 | 348 | return WrapBox::<T>(b); | 29 | 348 | } |
<alloc_stdlib::heap_alloc::WrapBox<f32> as core::default::Default>::default Line | Count | Source | 25 | 14.7k | fn default() -> Self { | 26 | 14.7k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 14.7k | let b = v.into_boxed_slice(); | 28 | 14.7k | return WrapBox::<T>(b); | 29 | 14.7k | } |
<alloc_stdlib::heap_alloc::WrapBox<i32> as core::default::Default>::default Line | Count | Source | 25 | 25.8k | fn default() -> Self { | 26 | 25.8k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 25.8k | let b = v.into_boxed_slice(); | 28 | 25.8k | return WrapBox::<T>(b); | 29 | 25.8k | } |
<alloc_stdlib::heap_alloc::WrapBox<u16> as core::default::Default>::default Line | Count | Source | 25 | 68.4k | fn default() -> Self { | 26 | 68.4k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 68.4k | let b = v.into_boxed_slice(); | 28 | 68.4k | return WrapBox::<T>(b); | 29 | 68.4k | } |
<alloc_stdlib::heap_alloc::WrapBox<u64> as core::default::Default>::default Line | Count | Source | 25 | 1.47k | fn default() -> Self { | 26 | 1.47k | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 1.47k | let b = v.into_boxed_slice(); | 28 | 1.47k | return WrapBox::<T>(b); | 29 | 1.47k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli_decompressor::huffman::HuffmanCode> as core::default::Default>::default Line | Count | Source | 25 | 24.7M | fn default() -> Self { | 26 | 24.7M | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 24.7M | let b = v.into_boxed_slice(); | 28 | 24.7M | return WrapBox::<T>(b); | 29 | 24.7M | } |
<alloc_stdlib::heap_alloc::WrapBox<u8> as core::default::Default>::default Line | Count | Source | 25 | 2.20M | fn default() -> Self { | 26 | 2.20M | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 2.20M | let b = v.into_boxed_slice(); | 28 | 2.20M | return WrapBox::<T>(b); | 29 | 2.20M | } |
<alloc_stdlib::heap_alloc::WrapBox<u32> as core::default::Default>::default Line | Count | Source | 25 | 25.8M | fn default() -> Self { | 26 | 25.8M | let v : std::vec::Vec<T> = std::vec::Vec::new(); | 27 | 25.8M | let b = v.into_boxed_slice(); | 28 | 25.8M | return WrapBox::<T>(b); | 29 | 25.8M | } |
|
30 | | } |
31 | | |
32 | | impl<T> super::SliceWrapper<T> for WrapBox<T> { |
33 | 8.35G | fn slice(&self) -> & [T] { |
34 | 8.35G | return &*self.0 |
35 | 8.35G | } Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>>>::slice <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::entropy_encode::HuffmanTree> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::entropy_encode::HuffmanTree>>::slice Line | Count | Source | 33 | 17.9M | fn slice(&self) -> & [T] { | 34 | 17.9M | return &*self.0 | 35 | 17.9M | } |
Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::compat::CompatF8> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::compat::CompatF8>>::slice <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::cluster::HistogramPair> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::cluster::HistogramPair>>::slice Line | Count | Source | 33 | 758 | fn slice(&self) -> & [T] { | 34 | 758 | return &*self.0 | 35 | 758 | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::command::Command> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::command::Command>>::slice Line | Count | Source | 33 | 11.1k | fn slice(&self) -> & [T] { | 34 | 11.1k | return &*self.0 | 35 | 11.1k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::ContextType> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::histogram::ContextType>>::slice Line | Count | Source | 33 | 6.57k | fn slice(&self) -> & [T] { | 34 | 6.57k | return &*self.0 | 35 | 6.57k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramCommand> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::histogram::HistogramCommand>>::slice Line | Count | Source | 33 | 51.0k | fn slice(&self) -> & [T] { | 34 | 51.0k | return &*self.0 | 35 | 51.0k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramLiteral> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::histogram::HistogramLiteral>>::slice Line | Count | Source | 33 | 350k | fn slice(&self) -> & [T] { | 34 | 350k | return &*self.0 | 35 | 350k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramDistance> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::histogram::HistogramDistance>>::slice Line | Count | Source | 33 | 45.6k | fn slice(&self) -> & [T] { | 34 | 45.6k | return &*self.0 | 35 | 45.6k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode>>::slice Line | Count | Source | 33 | 14.4k | fn slice(&self) -> & [T] { | 34 | 14.4k | return &*self.0 | 35 | 14.4k | } |
<alloc_stdlib::heap_alloc::WrapBox<f32> as alloc_no_stdlib::allocated_memory::SliceWrapper<f32>>::slice Line | Count | Source | 33 | 4.43G | fn slice(&self) -> & [T] { | 34 | 4.43G | return &*self.0 | 35 | 4.43G | } |
<alloc_stdlib::heap_alloc::WrapBox<i32> as alloc_no_stdlib::allocated_memory::SliceWrapper<i32>>::slice Line | Count | Source | 33 | 22.5k | fn slice(&self) -> & [T] { | 34 | 22.5k | return &*self.0 | 35 | 22.5k | } |
<alloc_stdlib::heap_alloc::WrapBox<u16> as alloc_no_stdlib::allocated_memory::SliceWrapper<u16>>::slice Line | Count | Source | 33 | 77.9M | fn slice(&self) -> & [T] { | 34 | 77.9M | return &*self.0 | 35 | 77.9M | } |
<alloc_stdlib::heap_alloc::WrapBox<u64> as alloc_no_stdlib::allocated_memory::SliceWrapper<u64>>::slice Line | Count | Source | 33 | 46.1M | fn slice(&self) -> & [T] { | 34 | 46.1M | return &*self.0 | 35 | 46.1M | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli_decompressor::huffman::HuffmanCode> as alloc_no_stdlib::allocated_memory::SliceWrapper<brotli_decompressor::huffman::HuffmanCode>>::slice Line | Count | Source | 33 | 117M | fn slice(&self) -> & [T] { | 34 | 117M | return &*self.0 | 35 | 117M | } |
<alloc_stdlib::heap_alloc::WrapBox<u8> as alloc_no_stdlib::allocated_memory::SliceWrapper<u8>>::slice Line | Count | Source | 33 | 3.48G | fn slice(&self) -> & [T] { | 34 | 3.48G | return &*self.0 | 35 | 3.48G | } |
<alloc_stdlib::heap_alloc::WrapBox<u32> as alloc_no_stdlib::allocated_memory::SliceWrapper<u32>>::slice Line | Count | Source | 33 | 174M | fn slice(&self) -> & [T] { | 34 | 174M | return &*self.0 | 35 | 174M | } |
|
36 | | } |
37 | | |
38 | | impl<T> super::SliceWrapperMut<T> for WrapBox<T> { |
39 | 6.13G | fn slice_mut(&mut self) -> &mut [T] { |
40 | 6.13G | return &mut*self.0 |
41 | 6.13G | } Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::interface::Command<brotli::enc::interface::SliceOffset>>>::slice_mut <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::entropy_encode::HuffmanTree> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::entropy_encode::HuffmanTree>>::slice_mut Line | Count | Source | 39 | 15.2M | fn slice_mut(&mut self) -> &mut [T] { | 40 | 15.2M | return &mut*self.0 | 41 | 15.2M | } |
Unexecuted instantiation: <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::compat::Compat16x16> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::compat::Compat16x16>>::slice_mut <alloc_stdlib::heap_alloc::WrapBox<brotli::enc::compat::CompatF8> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::compat::CompatF8>>::slice_mut Line | Count | Source | 39 | 19.9k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 19.9k | return &mut*self.0 | 41 | 19.9k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::cluster::HistogramPair> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::cluster::HistogramPair>>::slice_mut Line | Count | Source | 39 | 54.6k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 54.6k | return &mut*self.0 | 41 | 54.6k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::command::Command> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::command::Command>>::slice_mut Line | Count | Source | 39 | 38.0k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 38.0k | return &mut*self.0 | 41 | 38.0k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::ContextType> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::histogram::ContextType>>::slice_mut Line | Count | Source | 39 | 6.57k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 6.57k | return &mut*self.0 | 41 | 6.57k | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramCommand> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::histogram::HistogramCommand>>::slice_mut Line | Count | Source | 39 | 6.51M | fn slice_mut(&mut self) -> &mut [T] { | 40 | 6.51M | return &mut*self.0 | 41 | 6.51M | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramLiteral> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::histogram::HistogramLiteral>>::slice_mut Line | Count | Source | 39 | 54.5M | fn slice_mut(&mut self) -> &mut [T] { | 40 | 54.5M | return &mut*self.0 | 41 | 54.5M | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::histogram::HistogramDistance> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::histogram::HistogramDistance>>::slice_mut Line | Count | Source | 39 | 3.81M | fn slice_mut(&mut self) -> &mut [T] { | 40 | 3.81M | return &mut*self.0 | 41 | 3.81M | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli::enc::backward_references::hash_to_binary_tree::ZopfliNode>>::slice_mut Line | Count | Source | 39 | 28.8k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 28.8k | return &mut*self.0 | 41 | 28.8k | } |
<alloc_stdlib::heap_alloc::WrapBox<f32> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<f32>>::slice_mut Line | Count | Source | 39 | 48.8k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 48.8k | return &mut*self.0 | 41 | 48.8k | } |
<alloc_stdlib::heap_alloc::WrapBox<i32> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<i32>>::slice_mut Line | Count | Source | 39 | 22.5k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 22.5k | return &mut*self.0 | 41 | 22.5k | } |
<alloc_stdlib::heap_alloc::WrapBox<u16> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u16>>::slice_mut Line | Count | Source | 39 | 36.9M | fn slice_mut(&mut self) -> &mut [T] { | 40 | 36.9M | return &mut*self.0 | 41 | 36.9M | } |
<alloc_stdlib::heap_alloc::WrapBox<u64> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u64>>::slice_mut Line | Count | Source | 39 | 88.3M | fn slice_mut(&mut self) -> &mut [T] { | 40 | 88.3M | return &mut*self.0 | 41 | 88.3M | } |
<alloc_stdlib::heap_alloc::WrapBox<brotli_decompressor::huffman::HuffmanCode> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<brotli_decompressor::huffman::HuffmanCode>>::slice_mut Line | Count | Source | 39 | 723k | fn slice_mut(&mut self) -> &mut [T] { | 40 | 723k | return &mut*self.0 | 41 | 723k | } |
<alloc_stdlib::heap_alloc::WrapBox<u8> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u8>>::slice_mut Line | Count | Source | 39 | 5.52G | fn slice_mut(&mut self) -> &mut [T] { | 40 | 5.52G | return &mut*self.0 | 41 | 5.52G | } |
<alloc_stdlib::heap_alloc::WrapBox<u32> as alloc_no_stdlib::allocated_memory::SliceWrapperMut<u32>>::slice_mut Line | Count | Source | 39 | 407M | fn slice_mut(&mut self) -> &mut [T] { | 40 | 407M | return &mut*self.0 | 41 | 407M | } |
|
42 | | } |
43 | | impl<T> ops::Index<usize> for WrapBox<T> { |
44 | | type Output = T; |
45 | | fn index(&self, index: usize) -> &T { |
46 | | &(*self.0)[index] |
47 | | } |
48 | | } |
49 | | |
50 | | impl<T> ops::IndexMut<usize> for WrapBox<T> { |
51 | | fn index_mut(&mut self, index: usize) -> &mut T { |
52 | | &mut (*self.0)[index] |
53 | | } |
54 | | } |
55 | | |
56 | | impl<T> ops::Index<Range<usize>> for WrapBox<T> { |
57 | | type Output = [T]; |
58 | | fn index(&self, index: Range<usize>) -> &[T] { |
59 | | &(*self.0)[index] |
60 | | } |
61 | | } |
62 | | |
63 | | impl<T> ops::IndexMut<Range<usize>> for WrapBox<T> { |
64 | | fn index_mut(&mut self, index: Range<usize>) -> &mut [T] { |
65 | | &mut (*self.0)[index] |
66 | | } |
67 | | } |
68 | | |
69 | | |
70 | | pub struct HeapAlloc<T : Clone>{ |
71 | | pub default_value : T, |
72 | | } |
73 | | |
74 | | impl<T: Clone+Default> Default for HeapAlloc<T> { |
75 | | fn default() -> Self { |
76 | | Self::new(T::default()) |
77 | | } |
78 | | } |
79 | | |
80 | | impl<T : Clone> HeapAlloc<T> { |
81 | | pub fn new(data : T) -> HeapAlloc<T> { |
82 | | return HeapAlloc::<T>{default_value : data}; |
83 | | } |
84 | | } |
85 | | |
86 | | impl<T : Clone> super::Allocator<T> for HeapAlloc<T> { |
87 | | type AllocatedMemory = WrapBox<T>; |
88 | | fn alloc_cell(self : &mut HeapAlloc<T>, len : usize) -> WrapBox<T> { |
89 | | |
90 | | let v : std::vec::Vec<T> = vec![self.default_value.clone();len]; |
91 | | let b = v.into_boxed_slice(); |
92 | | return WrapBox::<T>(b); |
93 | | } |
94 | | fn free_cell(self : &mut HeapAlloc<T>, _data : WrapBox<T>) { |
95 | | |
96 | | } |
97 | | } |
98 | | |
99 | | #[deprecated] |
100 | | pub type HeapAllocUninitialized<T> = HeapAlloc<T>; |
101 | | |
102 | | |
103 | | pub struct HeapPrealloc<'a, T : 'a> { |
104 | | freelist : std::boxed::Box<[&'a mut [T]]>, |
105 | | } |
106 | | define_stack_allocator_traits!(HeapPrealloc, heap); |
107 | | |
108 | | impl<'a, T : Clone+'a> HeapPrealloc<'a, T> { |
109 | | fn make_freelist(freelist_size : usize) -> std::boxed::Box<[&'a mut[T]]> { |
110 | | let mut retval = Vec::<&'a mut[T]>::with_capacity(freelist_size); |
111 | | for _i in 0..freelist_size { |
112 | | retval.push(&mut[]); |
113 | | } |
114 | | return retval.into_boxed_slice(); |
115 | | } |
116 | | pub fn new_allocator(freelist_size : usize, |
117 | | memory_pool : &'a mut Box<[T]>, |
118 | | initializer : fn(&mut[T])) -> super::StackAllocator<'a, T, HeapPrealloc<'a, T> > { |
119 | | let mut retval = super::StackAllocator::<T, HeapPrealloc<T> > { |
120 | | nop : &mut [], |
121 | | system_resources : HeapPrealloc::<T> { |
122 | | freelist : Self::make_freelist(freelist_size), |
123 | | }, |
124 | | free_list_start : freelist_size, |
125 | | free_list_overflow_count : 0, |
126 | | initialize : initializer, |
127 | | }; |
128 | | retval.free_cell(super::AllocatedStackMemory::<T>{mem:&mut*memory_pool}); |
129 | | return retval; |
130 | | } |
131 | | #[cfg(feature="unsafe")] |
132 | | pub unsafe fn new_uninitialized_memory_pool(len : usize) -> Box<[T]> { |
133 | | let mut v : std::vec::Vec<T> = std::vec::Vec::with_capacity(len); |
134 | | v.set_len(len); |
135 | | return v.into_boxed_slice(); |
136 | | } |
137 | | } |
138 | | |