1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
#[cfg(feature = "smallvec")]
use smallvec::{Array as SmallVecArray, SmallVec};
pub trait Push<T> {
type PushRet;
fn push(&mut self, elem: T) -> Self::PushRet;
}
#[cfg(feature = "smallvec")]
impl<A> Push<A::Item> for SmallVec<A>
where
A: SmallVecArray,
{
type PushRet = ();
fn push(&mut self, elem: A::Item) -> Self::PushRet {
self.push(elem);
}
}
#[cfg(feature = "alloc")]
impl<T> Push<T> for Vec<T> {
type PushRet = ();
fn push(&mut self, elem: T) -> Self::PushRet {
self.push(elem);
}
}