Loading RustViz Engine...
Build high-frequency trading ring buffer using cache-line padded atomic indices.
This problem is currently in blueprint template mode. Once the concept foundation is finalized, live in-browser WebAssembly compilation and test assertion runners will be enabled here.
use std::sync::atomic::{AtomicUsize, Ordering};
#[repr(align(64))]
pub struct SPSCQueue<T> {
head: AtomicUsize,
tail: AtomicUsize,
capacity: usize,
_marker: std::marker::PhantomData<T>,
}
impl<T> SPSCQueue<T> {
pub fn new(capacity: usize) -> Self {
Self {
head: AtomicUsize::new(0),
tail: AtomicUsize::new(0),
capacity,
_marker: std::marker::PhantomData,
}
}
}