1pub mod pool;
2pub mod ring;
3
4pub use pool::*;
5pub use ring::*;
6pub const XS_CAPACITY: usize = 2000; pub const S_CAPACITY: usize = 1000; pub const M_CAPACITY: usize = 300; pub const L_CAPACITY: usize = 60; pub const XL_CAPACITY: usize = 15; pub const XS_TSHIRT_SIZE: usize = 64;
13pub const S_TSHIRT_SIZE: usize = 256;
14pub const M_TSHIRT_SIZE: usize = 1024;
15pub const L_TSHIRT_SIZE: usize = 4096;
16pub const XL_TSHIRT_SIZE: usize = 16384;
17
18#[derive(Debug)]
25pub struct RingSource<const TSHIRT_SIZE: usize, const RING_CAPACITY: usize> {
26 pub writer: Writer<TSHIRT_SIZE, RING_CAPACITY>,
27}
28impl<const TSHIRT_SIZE: usize, const RING_CAPACITY: usize> RingSource<TSHIRT_SIZE, RING_CAPACITY> {
29 pub fn new(out_buffer: &'static RingBuffer<TSHIRT_SIZE, RING_CAPACITY>) -> Self {
30 RingSource {
31 writer: Writer::new(out_buffer),
32 }
33 }
34}
35
36#[derive(Debug, Clone)]
40pub struct RingSink<const TSHIRT_SIZE: usize, const RING_CAPACITY: usize> {
41 pub reader: Reader<TSHIRT_SIZE, RING_CAPACITY>,
42}
43
44impl<const TSHIRT_SIZE: usize, const RING_CAPACITY: usize> RingSink<TSHIRT_SIZE, RING_CAPACITY> {
45 pub fn new(in_buffer: &'static RingBuffer<TSHIRT_SIZE, RING_CAPACITY>) -> Self {
46 RingSink {
47 reader: Reader::new(in_buffer),
48 }
49 }
50}
51
52#[derive(Debug)]
61pub struct RingPipe<const TSHIRT_SIZE: usize, const RING_CAPACITY: usize> {
62 pub source: RingSource<TSHIRT_SIZE, RING_CAPACITY>,
63 pub sink: RingSink<TSHIRT_SIZE, RING_CAPACITY>,
64}
65
66impl<const TSHIRT_SIZE: usize, const RING_CAPACITY: usize> RingPipe<TSHIRT_SIZE, RING_CAPACITY> {
67 pub fn new(
68 in_buffer: &'static RingBuffer<TSHIRT_SIZE, RING_CAPACITY>,
69 out_buffer: &'static RingBuffer<TSHIRT_SIZE, RING_CAPACITY>,
70 ) -> Self {
71 RingPipe {
72 source: RingSource::new(out_buffer),
73 sink: RingSink::new(in_buffer),
74 }
75 }
76}