Skip to main content

muxing/
lib.rs

1mod error;
2mod frame;
3mod tagged_stream;
4
5pub(crate) mod connection;
6
7const MAX_ACK_BACKLOG: usize = 256;
8
9pub use crate::frame::header::StreamId;
10pub use connection::{Connection, Endpoint, Stream};
11pub use error::{ConnectionError, FrameDecodeError};
12
13pub type Result<T> = std::result::Result<T, ConnectionError>;
14
15#[derive(Debug, Clone)]
16pub struct Config {
17    max_active_streams: usize,
18    read_after_close: bool,
19}
20
21impl Default for Config {
22    fn default() -> Self {
23        Config {
24            max_active_streams: 512,
25            read_after_close: true,
26        }
27    }
28}
29
30impl Config {
31    pub fn new() -> Self {
32        Config::default()
33    }
34
35    pub fn set_max_active_streams(&mut self, max_active_streams: usize) -> &mut Self {
36        self.max_active_streams = max_active_streams;
37        self
38    }
39
40    pub fn set_read_after_close(&mut self, read_after_close: bool) -> &mut Self {
41        self.read_after_close = read_after_close;
42        self
43    }
44}