MaulingMonkey / ialloc

Allocator interface traits for Rust
Apache License 2.0
2 stars 0 forks source link

Integer bit mask based allocators? #21

Open MaulingMonkey opened 1 year ago

MaulingMonkey commented 1 year ago
trait Unsigned {
    const BITS : usize = 8 * size_of::<Self>();
    fn bit(i: usize) -> Self { todo!() }
}
impl Unsigned for u8 {}
impl Unsigned for u16 {}
impl Unsigned for u32 {}
impl Unsigned for u64 {}
impl Unsigned for u128 {}
impl Unsigned for usize {}

struct ChunkAllocator<B: Unsigned, T>(B, [T; B::BITS]); // ?