pub struct BodyBudget { /* private fields */ }Expand description
Bounds both inspected body bytes and produced log-safe bytes.
Implementations§
Source§impl BodyBudget
impl BodyBudget
Sourcepub const MIN_OUTPUT_BYTES: usize
pub const MIN_OUTPUT_BYTES: usize
Smallest output limit that can contain the truncation marker.
Sourcepub const fn new(
max_input_bytes: usize,
max_output_bytes: usize,
) -> Result<Self, BodyBudgetError>
pub const fn new( max_input_bytes: usize, max_output_bytes: usize, ) -> Result<Self, BodyBudgetError>
Creates checked hard limits for body processing.
§Parameters
max_input_bytes- Maximum source bytes available to body parsers.max_output_bytes- Maximum bytes in the final log-safe result, including a complete truncation marker when required.
§Returns
A checked finite body budget.
§Errors
Returns BodyBudgetError::ZeroInput when max_input_bytes is zero,
or BodyBudgetError::OutputTooSmall when the output limit cannot
contain the complete truncation marker.
Sourcepub const fn max_input_bytes(self) -> usize
pub const fn max_input_bytes(self) -> usize
Returns the maximum number of source bytes parsers may inspect.
§Returns
The positive input limit in bytes.
Sourcepub const fn max_output_bytes(self) -> usize
pub const fn max_output_bytes(self) -> usize
Returns the maximum final log-safe output size.
§Returns
The output limit in bytes, including any truncation marker.
Trait Implementations§
Source§impl Clone for BodyBudget
impl Clone for BodyBudget
Source§fn clone(&self) -> BodyBudget
fn clone(&self) -> BodyBudget
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BodyBudget
Source§impl Debug for BodyBudget
impl Debug for BodyBudget
Source§impl Default for BodyBudget
impl Default for BodyBudget
impl Eq for BodyBudget
Source§impl PartialEq for BodyBudget
impl PartialEq for BodyBudget
impl StructuralPartialEq for BodyBudget
Auto Trait Implementations§
impl Freeze for BodyBudget
impl RefUnwindSafe for BodyBudget
impl Send for BodyBudget
impl Sync for BodyBudget
impl Unpin for BodyBudget
impl UnsafeUnpin for BodyBudget
impl UnwindSafe for BodyBudget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more