|
| 1 | +//! TODO docs! |
| 2 | +
|
| 3 | +use tokio::time::Duration; |
| 4 | + |
| 5 | +use crate::{ |
| 6 | + DEFAULT_BATCH_BUF_SIZE, |
| 7 | + DEFAULT_MAX_BATCH_DELAY, |
| 8 | + DEFAULT_QUEUE_CAPACITY, |
| 9 | +}; |
| 10 | + |
| 11 | +/// TODO docs! |
| 12 | +#[derive(Debug)] |
| 13 | +pub struct Builder<T, S> { |
| 14 | + pub(crate) addr: T, |
| 15 | + pub(crate) sock: S, |
| 16 | + pub(crate) queue_cap: usize, |
| 17 | + pub(crate) buf_size: usize, |
| 18 | + pub(crate) max_delay: Duration, |
| 19 | +} |
| 20 | + |
| 21 | +impl<T, S> Builder<T, S> { |
| 22 | + pub(crate) fn new(addr: T, sock: S) -> Self { |
| 23 | + Self { |
| 24 | + addr, |
| 25 | + sock, |
| 26 | + queue_cap: DEFAULT_QUEUE_CAPACITY, |
| 27 | + buf_size: DEFAULT_BATCH_BUF_SIZE, |
| 28 | + max_delay: DEFAULT_MAX_BATCH_DELAY, |
| 29 | + } |
| 30 | + } |
| 31 | + |
| 32 | + /// TODO docs! |
| 33 | + pub fn queue_cap(&mut self, queue_cap: usize) -> &mut Self { |
| 34 | + self.queue_cap = queue_cap; |
| 35 | + self |
| 36 | + } |
| 37 | + |
| 38 | + /// TODO docs! |
| 39 | + pub fn buf_size(&mut self, buf_size: usize) -> &mut Self { |
| 40 | + self.buf_size = buf_size; |
| 41 | + self |
| 42 | + } |
| 43 | + |
| 44 | + /// TODO docs! |
| 45 | + pub fn max_delay(&mut self, max_delay: Duration) -> &mut Self { |
| 46 | + self.max_delay = max_delay; |
| 47 | + self |
| 48 | + } |
| 49 | +} |
0 commit comments