Newer
Older
vengine / engine-core / src / small_vec.rs
Maple Nebel Maple Nebel 9 days ago 487 bytes things
use std::{
    alloc::{Allocator, Global},
    array,
    mem::MaybeUninit,
};

pub struct SmallVec<T, const N: usize = 0, A: Allocator = Global> {
    inline_storage: [MaybeUninit<T>; N],

    allocator: A,
}

impl<T, const N: usize, A: Allocator> SmallVec<T, N, A> {
    const fn new() -> Self
    where
        A: [const] Default,
    {
        Self {
            inline_storage: array::from_fn(const |_| MaybeUninit::uninit()),
            allocator: A::default(),
        }
    }
}