mirror of https://git.sr.ht/~stygianentity/bincode
update documentation to reflect new config options (#329)
This commit is contained in:
parent
e80f61b9da
commit
752262a03d
|
|
@ -23,7 +23,7 @@ use serde;
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[deprecated(
|
#[deprecated(
|
||||||
since = "1.3.0",
|
since = "1.3.0",
|
||||||
note = "please use the `DefaultOptions`/`OptionsExt` system instead"
|
note = "please use the `DefaultOptions`/`Options` system instead"
|
||||||
)]
|
)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
limit: LimitOption,
|
limit: LimitOption,
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ impl DefaultOptions {
|
||||||
///
|
///
|
||||||
/// ### Default Configuration:
|
/// ### Default Configuration:
|
||||||
///
|
///
|
||||||
/// | Byte limit | Endianness | Int Encoding |
|
/// | Byte limit | Endianness | Int Encoding | Trailing Behavior |
|
||||||
/// |------------|------------|--------------|
|
/// |------------|------------|--------------|-------------------|
|
||||||
/// | Unlimited | Little | Varint |
|
/// | Unlimited | Little | Varint | Reject |
|
||||||
pub fn new() -> DefaultOptions {
|
pub fn new() -> DefaultOptions {
|
||||||
DefaultOptions(Infinite)
|
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*
|
/// 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
|
/// ### Byte Limit Details
|
||||||
/// The purpose of byte-limiting is to prevent Denial-Of-Service attacks whereby malicious attackers get bincode
|
/// 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.
|
/// deserialization to crash your process by allocating too much memory or keeping a connection open for too long.
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ pub fn config() -> Config {
|
||||||
///
|
///
|
||||||
/// ### Default Configuration:
|
/// ### Default Configuration:
|
||||||
///
|
///
|
||||||
/// | Byte limit | Endianness | Int Encoding |
|
/// | Byte limit | Endianness | Int Encoding | Trailing Behavior |
|
||||||
/// |------------|------------|--------------|
|
/// |------------|------------|--------------|-------------------|
|
||||||
/// | Unlimited | Little | Varint |
|
/// | Unlimited | Little | Varint | Reject |
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn options() -> DefaultOptions {
|
pub fn options() -> DefaultOptions {
|
||||||
DefaultOptions::new()
|
DefaultOptions::new()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue