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