turbocow 0.3.0-beta.2

Compact, clone-on-write vectors, strings, maps and sets with inline + referenced storage — a superset of ecow.
Documentation
use crate::{allocator::Global, vec::types};

/// An [`EcoVec`](types::EcoVec) using the global allocator.
pub type EcoVec<T> = types::EcoVec<T, Global>;

/// Create a new [`EcoVec`] with the given elements.
/// ```
/// # use turbocow::eco_vec;
/// assert_eq!(eco_vec![1; 4], [1; 4]);
/// assert_eq!(eco_vec![1, 2, 3], [1, 2, 3]);
/// ```
#[macro_export]
macro_rules! eco_vec {
    () => {
        $crate::EcoVec::new()
    };

    ($elem:expr; $n:expr) => {
        $crate::EcoVec::from_elem($elem, $n)
    };
    ($($value:expr),+ $(,)?) => {
        $crate::EcoVec::from([$($value),+])
    };
}