| 1 | use crate::{ |
| 2 | Back, BackMut, Capacity, Clear, Collection, CollectionMut, CollectionRef, Front, FrontMut, Len, |
| 3 | PopBack, PushBack, Reserve, SimpleCollectionMut, SimpleCollectionRef, WithCapacity, |
| 4 | }; |
| 5 | use alloc::collections::VecDeque; |
| 6 | |
| 7 | impl<T> Collection for VecDeque<T> { |
| 8 | type Item = T; |
| 9 | } |
| 10 | |
| 11 | impl<T> CollectionRef for VecDeque<T> { |
| 12 | type ItemRef<'a> = &'a T where Self: 'a; |
| 13 | |
| 14 | crate::covariant_item_ref!(); |
| 15 | } |
| 16 | |
| 17 | impl<T> CollectionMut for VecDeque<T> { |
| 18 | type ItemMut<'a> = &'a mut T where Self: 'a; |
| 19 | |
| 20 | crate::covariant_item_mut!(); |
| 21 | } |
| 22 | |
| 23 | impl<T> SimpleCollectionRef for VecDeque<T> { |
| 24 | crate::simple_collection_ref!(); |
| 25 | } |
| 26 | |
| 27 | impl<T> SimpleCollectionMut for VecDeque<T> { |
| 28 | crate::simple_collection_mut!(); |
| 29 | } |
| 30 | |
| 31 | impl<T> WithCapacity for VecDeque<T> { |
| 32 | #[inline(always)] |
| 33 | fn with_capacity(capacity: usize) -> Self { |
| 34 | VecDeque::with_capacity(capacity) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | impl<T> Len for VecDeque<T> { |
| 39 | #[inline(always)] |
| 40 | fn len(&self) -> usize { |
| 41 | self.len() |
| 42 | } |
| 43 | |
| 44 | #[inline(always)] |
| 45 | fn is_empty(&self) -> bool { |
| 46 | self.is_empty() |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | impl<T> Capacity for VecDeque<T> { |
| 51 | #[inline(always)] |
| 52 | fn capacity(&self) -> usize { |
| 53 | self.capacity() |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | impl<T> Reserve for VecDeque<T> { |
| 58 | #[inline(always)] |
| 59 | fn reserve(&mut self, additional: usize) { |
| 60 | self.reserve(additional) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | impl<T> Front for VecDeque<T> { |
| 65 | #[inline(always)] |
| 66 | fn front(&self) -> Option<&T> { |
| 67 | self.front() |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | impl<T> FrontMut for VecDeque<T> { |
| 72 | #[inline(always)] |
| 73 | fn front_mut(&mut self) -> Option<&mut T> { |
| 74 | self.front_mut() |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | impl<T> Back for VecDeque<T> { |
| 79 | #[inline(always)] |
| 80 | fn back(&self) -> Option<&T> { |
| 81 | self.back() |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | impl<T> BackMut for VecDeque<T> { |
| 86 | #[inline(always)] |
| 87 | fn back_mut(&mut self) -> Option<&mut T> { |
| 88 | self.back_mut() |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | impl<T> PushBack for VecDeque<T> { |
| 93 | type Output = (); |
| 94 | |
| 95 | #[inline(always)] |
| 96 | fn push_back(&mut self, t: T) { |
| 97 | self.push_back(t) |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | impl<T> PopBack for VecDeque<T> { |
| 102 | #[inline(always)] |
| 103 | fn pop_back(&mut self) -> Option<T> { |
| 104 | self.pop_back() |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | impl<T> Clear for VecDeque<T> { |
| 109 | #[inline(always)] |
| 110 | fn clear(&mut self) { |
| 111 | self.clear() |
| 112 | } |
| 113 | } |