pub struct Config {
pub max_packet_size: usize,
pub compression: Compression,
}
Expand description
Fields§
§max_packet_size: usize
max_packet_size
is the maximum size of a packet in bytes.
It is used to limit the size of a packet that can be received or sent.
The default value is 1 << 20
.
§Example
use tcp_handler::config::Config;
let config = Config {
max_packet_size: 1 << 10,
..Config::default()
};
compression: Compression
compression
is the flate2::Compression
level when sending packets.
§Example
use tcp_handler::config::Config;
use tcp_handler::Compression;
let config = Config {
compression: Compression::fast(),
..Config::default()
};
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Config
impl Eq for Config
impl StructuralPartialEq for Config
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