bad attempt at porting from c

too low-level to use C directly. I really wonder if rust is the language
to get direct memory access with. It clearly solves memory mgmt with
static typing, and in this instance, it's actually high-level.
split out ring buffers.