-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
117 additions
and
101 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Deserialize, Serialize)] | ||
// Packet compression | ||
/// Packet compression | ||
pub struct CompressionConfig { | ||
/// Is compression enabled ? | ||
pub enabled: bool, | ||
#[serde(flatten)] | ||
pub compression_info: CompressionInfo, | ||
} | ||
|
||
#[derive(Deserialize, Serialize, Clone)] | ||
/// We have this in a Seperate struct so we can use it outside of the Config | ||
pub struct CompressionInfo { | ||
/// The compression threshold used when compression is enabled | ||
pub compression_threshold: u32, | ||
pub threshold: u32, | ||
/// A value between 0..9 | ||
/// 1 = Optimize for the best speed of encoding. | ||
/// 9 = Optimize for the size of data being encoded. | ||
pub compression_level: u32, | ||
pub level: u32, | ||
} | ||
|
||
impl Default for CompressionInfo { | ||
fn default() -> Self { | ||
Self { | ||
threshold: 256, | ||
level: 4, | ||
} | ||
} | ||
} | ||
|
||
impl Default for CompressionConfig { | ||
fn default() -> Self { | ||
Self { | ||
enabled: true, | ||
compression_threshold: 256, | ||
compression_level: 4, | ||
compression_info: Default::default(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.