From 752262a03dcba9c79cea69140ac1a0b32369b94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lena=20Hellstr=C3=B6m?= Date: Thu, 4 Jun 2020 21:20:00 -0700 Subject: [PATCH] update documentation to reflect new config options (#329) --- src/config/legacy.rs | 2 +- src/config/mod.rs | 10 +++++++--- src/lib.rs | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/config/legacy.rs b/src/config/legacy.rs index a9ac065..a851f7e 100644 --- a/src/config/legacy.rs +++ b/src/config/legacy.rs @@ -23,7 +23,7 @@ use serde; #[derive(Clone, Debug)] #[deprecated( since = "1.3.0", - note = "please use the `DefaultOptions`/`OptionsExt` system instead" + note = "please use the `DefaultOptions`/`Options` system instead" )] pub struct Config { limit: LimitOption, diff --git a/src/config/mod.rs b/src/config/mod.rs index 9fdc154..bf90dee 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -35,9 +35,9 @@ impl DefaultOptions { /// /// ### Default Configuration: /// - /// | Byte limit | Endianness | Int Encoding | - /// |------------|------------|--------------| - /// | Unlimited | Little | Varint | + /// | Byte limit | Endianness | Int Encoding | Trailing Behavior | + /// |------------|------------|--------------|-------------------| + /// | Unlimited | Little | Varint | Reject | pub fn new() -> DefaultOptions { DefaultOptions(Infinite) } @@ -69,6 +69,10 @@ impl InternalOptions for DefaultOptions { /// /// Limit: The maximum number of bytes that will be read/written in a bincode serialize/deserialize. *default: unlimited* /// +/// Int Encoding: The encoding used for numbers, enum discriminants, and lengths. *default: varint* +/// +/// Trailing Behavior: The behavior when there are trailing bytes left over in a slice after deserialization. *default: reject* +/// /// ### Byte Limit Details /// The purpose of byte-limiting is to prevent Denial-Of-Service attacks whereby malicious attackers get bincode /// deserialization to crash your process by allocating too much memory or keeping a connection open for too long. diff --git a/src/lib.rs b/src/lib.rs index f8c1968..d33ec2c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,9 +65,9 @@ pub fn config() -> Config { /// /// ### Default Configuration: /// -/// | Byte limit | Endianness | Int Encoding | -/// |------------|------------|--------------| -/// | Unlimited | Little | Varint | +/// | Byte limit | Endianness | Int Encoding | Trailing Behavior | +/// |------------|------------|--------------|-------------------| +/// | Unlimited | Little | Varint | Reject | #[inline(always)] pub fn options() -> DefaultOptions { DefaultOptions::new()