Skip to content

Instantly share code, notes, and snippets.

View lib.rs
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,
}