Skip to content

Instantly share code, notes, and snippets.

@DaTa-
DaTa- / lib.rs
Created September 16, 2020 20:56
use std::{alloc, alloc::Layout, convert::TryInto, ptr, ptr::NonNull};
pub struct CircularBuffer<T> {
// no need for PhantomData since NonNull is covariant over T
buffer: NonNull<T>,
offset: isize,
len: isize,
capacity: isize,
}