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)]
|
||||
#[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,
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue