Debian Codegraph @

.cargo/vendor/bumpalo/src/collections/mod.rs

raw
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Collection types that allocate inside a [`Bump`] arena.
12 //!
13 //! [`Bump`]: ../struct.Bump.html
14
15 #![allow(deprecated)]
16
17 mod raw_vec;
18
19 pub mod vec;
20 pub use self::vec::Vec;
21
22 mod str;
23 pub mod string;
24 pub use self::string::String;
25
26 mod collect_in;
27 pub use collect_in::{CollectIn, FromIteratorIn};
28
29 // pub mod binary_heap;
30 // mod btree;
31 // pub mod linked_list;
32 // pub mod vec_deque;
33
34 // pub mod btree_map {
35 // //! A map based on a B-Tree.
36 // pub use super::btree::map::*;
37 // }
38
39 // pub mod btree_set {
40 // //! A set based on a B-Tree.
41 // pub use super::btree::set::*;
42 // }
43
44 // #[doc(no_inline)]
45 // pub use self::binary_heap::BinaryHeap;
46
47 // #[doc(no_inline)]
48 // pub use self::btree_map::BTreeMap;
49
50 // #[doc(no_inline)]
51 // pub use self::btree_set::BTreeSet;
52
53 // #[doc(no_inline)]
54 // pub use self::linked_list::LinkedList;
55
56 // #[doc(no_inline)]
57 // pub use self::vec_deque::VecDeque;
58
59 use crate::alloc::{AllocErr, LayoutErr};
60
61 /// Augments `AllocErr` with a `CapacityOverflow` variant.
62 #[derive(Clone, PartialEq, Eq, Debug)]
63 // #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
64 pub enum CollectionAllocErr {
65 /// Error due to the computed capacity exceeding the collection's maximum
66 /// (usually `isize::MAX` bytes).
67 CapacityOverflow,
68 /// Error due to the allocator (see the documentation for the [`AllocErr`] type).
69 AllocErr,
70 }
71
72 // #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
73 impl From<AllocErr> for CollectionAllocErr {
74 #[inline]
75 fn from(AllocErr: AllocErr) -> Self {
76 CollectionAllocErr::AllocErr
77 }
78 }
79
80 // #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
81 impl From<LayoutErr> for CollectionAllocErr {
82 #[inline]
83 fn from(_: LayoutErr) -> Self {
84 CollectionAllocErr::CapacityOverflow
85 }
86 }
87
88 // /// An intermediate trait for specialization of `Extend`.
89 // #[doc(hidden)]
90 // trait SpecExtend<I: IntoIterator> {
91 // /// Extends `self` with the contents of the given iterator.
92 // fn spec_extend(&mut self, iter: I);
93 // }