#[doc(hidden)]
#[macro_export]
macro_rules! slice_mut {
() => {
&mut [1, 2, 3]
};
}
use crate::SingleItemStorage;
#[cfg(feature = "alloc")]
use alloc::{
collections::{BTreeMap, BTreeSet},
string::String,
vec::Vec,
};
pub use slice_mut;
#[cfg(feature = "std")]
use std::collections::{HashMap, HashSet};
#[inline]
pub fn array() -> [i32; 3] {
[1, 2, 3]
}
#[cfg(feature = "arrayvec")]
#[inline]
pub fn array_string() -> arrayvec::ArrayString<10> {
let mut s = arrayvec::ArrayString::new();
s.push_str("Hello");
s
}
#[cfg(feature = "arrayvec")]
#[inline]
pub fn array_vec() -> arrayvec::ArrayVec<i32, 5> {
let mut vec = arrayvec::ArrayVec::new();
vec.extend([1, 2, 3].iter().copied());
vec
}
#[cfg(feature = "alloc")]
#[inline]
pub fn b_tree_map() -> BTreeMap<i32, i32> {
[(0, 1), (1, 2), (2, 3)].iter().copied().collect()
}
#[cfg(feature = "alloc")]
#[inline]
pub fn b_tree_set() -> BTreeSet<i32> {
[1, 2, 3].iter().copied().collect()
}
#[cfg(feature = "std")]
#[inline]
pub fn hash_map() -> HashMap<i32, i32> {
[(0, 1), (1, 2), (2, 3)].iter().copied().collect()
}
#[cfg(feature = "std")]
#[inline]
pub fn hash_set() -> HashSet<i32> {
[1, 2, 3].iter().copied().collect()
}
#[inline]
pub fn single_item_storage() -> SingleItemStorage<i32> {
1i32.into()
}
#[inline]
pub fn slice() -> &'static [i32] {
&[1, 2, 3]
}
#[cfg(feature = "smallvec")]
#[inline]
pub fn small_vec() -> smallvec::SmallVec<[i32; 5]> {
let mut vec = smallvec::SmallVec::new();
vec.extend([1, 2, 3].iter().copied());
vec
}
#[cfg(feature = "staticvec")]
#[inline]
pub fn static_vec() -> staticvec::StaticVec<i32, 5> {
let mut vec = staticvec::StaticVec::new();
vec.extend([1, 2, 3].iter().copied());
vec
}
#[cfg(feature = "alloc")]
#[inline]
pub fn string() -> String {
String::from("Hello")
}
#[cfg(feature = "tinyvec")]
#[inline]
pub fn tiny_vec() -> tinyvec::TinyVec<[i32; 5]> {
let mut vec = tinyvec::TinyVec::new();
vec.extend([1, 2, 3].iter().copied());
vec
}
#[cfg(feature = "tinyvec")]
#[inline]
pub fn tiny_vec_array_vec() -> tinyvec::ArrayVec<[i32; 5]> {
let mut vec = tinyvec::ArrayVec::new();
vec.extend([1, 2, 3].iter().copied());
vec
}
#[cfg(feature = "alloc")]
#[inline]
pub fn vec() -> Vec<i32> {
let mut vec = Vec::with_capacity(5);
vec.extend([1, 2, 3].iter().copied());
vec
}