packkit/limit
Types
Why a checked limits constructor rejected an argument.
pub type LimitError {
LimitMustBePositive(name: String, value: Int)
WindowBitsOutOfRange(value: Int)
}
Constructors
-
LimitMustBePositive(name: String, value: Int) -
WindowBitsOutOfRange(value: Int)
Values
pub fn max_entry_name_bytes(limits: Limits) -> Int
Read max_entry_name_bytes.
pub fn new(
max_input_bytes max_input_bytes: Int,
max_output_bytes max_output_bytes: Int,
max_members max_members: Int,
max_entry_name_bytes max_entry_name_bytes: Int,
max_entry_depth max_entry_depth: Int,
max_window_bits max_window_bits: Int,
) -> Limits
Panicking counterpart of new_checked.
pub fn new_checked(
max_input_bytes max_input_bytes: Int,
max_output_bytes max_output_bytes: Int,
max_members max_members: Int,
max_entry_name_bytes max_entry_name_bytes: Int,
max_entry_depth max_entry_depth: Int,
max_window_bits max_window_bits: Int,
) -> Result(Limits, LimitError)
Checked constructor for a full limits value.
pub fn with_max_entry_depth(
limits: Limits,
depth depth: Int,
) -> Limits
Unchecked setter for max_entry_depth.
pub fn with_max_entry_depth_checked(
limits: Limits,
depth depth: Int,
) -> Result(Limits, LimitError)
Update max_entry_depth after validation.
pub fn with_max_entry_name_bytes(
limits: Limits,
bytes bytes: Int,
) -> Limits
Unchecked setter for max_entry_name_bytes. See
[with_max_input_bytes] for the contract.
pub fn with_max_entry_name_bytes_checked(
limits: Limits,
bytes bytes: Int,
) -> Result(Limits, LimitError)
Update max_entry_name_bytes after validation.
pub fn with_max_input_bytes(
limits: Limits,
bytes bytes: Int,
) -> Limits
Unchecked setter for max_input_bytes. The caller is responsible
for passing a positive value; non-positive values are clamped to 1
to keep downstream decoders well-behaved.
pub fn with_max_input_bytes_checked(
limits: Limits,
bytes bytes: Int,
) -> Result(Limits, LimitError)
Update max_input_bytes after validation.
pub fn with_max_members(
limits: Limits,
count count: Int,
) -> Limits
Unchecked setter for max_members.
pub fn with_max_members_checked(
limits: Limits,
count count: Int,
) -> Result(Limits, LimitError)
Update max_members after validation.
pub fn with_max_output_bytes(
limits: Limits,
bytes bytes: Int,
) -> Limits
Unchecked setter for max_output_bytes. See [with_max_input_bytes]
for the contract.
pub fn with_max_output_bytes_checked(
limits: Limits,
bytes bytes: Int,
) -> Result(Limits, LimitError)
Update max_output_bytes after validation.
pub fn with_max_window_bits(
limits: Limits,
bits bits: Int,
) -> Limits
Unchecked setter for max_window_bits. Out-of-range values are
clamped to the valid 8..30 window.
pub fn with_max_window_bits_checked(
limits: Limits,
bits bits: Int,
) -> Result(Limits, LimitError)
Update max_window_bits after validation.