pub struct Config {
pub version: u8,
pub keep_alive_interval: Duration,
pub keep_alive_timeout: Duration,
pub max_frame_size: usize,
pub max_receive_buffer: usize,
pub max_stream_buffer: usize,
pub enable_keep_alive: bool,
}
Expand description
Configuration for a smux session.
Config
contains all the tunable parameters for a smux session, including
keep-alive settings, buffer sizes, and protocol version.
§Examples
§Using default configuration
use smux::Config;
let config = Config::default();
assert_eq!(config.version, 1);
assert!(config.enable_keep_alive);
§Creating custom configuration
use smux::{Config, ConfigBuilder};
use std::time::Duration;
let config = ConfigBuilder::new()
.version(2)
.keep_alive_interval(Duration::from_secs(30))
.max_frame_size(64 * 1024)
.build()
.expect("Valid configuration");
Fields§
§version: u8
§keep_alive_interval: Duration
§keep_alive_timeout: Duration
§max_frame_size: usize
§max_receive_buffer: usize
§max_stream_buffer: usize
§enable_keep_alive: bool
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more