#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::vec::Vec;
pub trait Remove {
type Input;
type Output;
fn remove(&mut self, input: Self::Input) -> Self::Output;
}
#[cfg(feature = "alloc")]
impl<T> Remove for Vec<T> {
type Input = usize;
type Output = T;
#[inline]
fn remove(&mut self, input: Self::Input) -> Self::Output {
self.remove(input)
}
}
#[cfg(feature = "with-arrayvec")]
impl<A> Remove for arrayvec::ArrayVec<A>
where
A: arrayvec::Array,
{
type Input = usize;
type Output = A::Item;
#[inline]
fn remove(&mut self, input: Self::Input) -> Self::Output {
self.remove(input)
}
}
#[cfg(feature = "with-smallvec")]
impl<A> Remove for smallvec::SmallVec<A>
where
A: smallvec::Array,
{
type Input = usize;
type Output = A::Item;
#[inline]
fn remove(&mut self, input: Self::Input) -> Self::Output {
self.remove(input)
}
}
#[cfg(feature = "with-staticvec")]
impl<T, const N: usize> Remove for staticvec::StaticVec<T, N> {
type Input = usize;
type Output = T;
#[inline]
fn remove(&mut self, input: Self::Input) -> Self::Output {
self.remove(input)
}
}
#[cfg(feature = "with-tinyvec")]
impl<A> Remove for tinyvec::ArrayVec<A>
where
A: tinyvec::Array,
A::Item: Default,
{
type Input = usize;
type Output = A::Item;
#[inline]
fn remove(&mut self, input: Self::Input) -> Self::Output {
self.remove(input)
}
}
#[cfg(all(feature = "alloc", feature = "with-tinyvec"))]
impl<A> Remove for tinyvec::TinyVec<A>
where
A: tinyvec::Array,
A::Item: Default,
{
type Input = usize;
type Output = A::Item;
#[inline]
fn remove(&mut self, input: Self::Input) -> Self::Output {
self.remove(input)
}
}