pub struct BodyLimit(/* private fields */);Expand description
Upper bound on a single response body, clamped at construction so no caller can
weaken the guard read_body_capped enforces past ABSOLUTE_MAX_RESPONSE_BYTES.
Every cache method that previously read MAX_RESPONSE_BYTES directly now takes
this newtype instead (defaulting to it via Self::DEFAULT), so a caller that
legitimately needs a larger cap — e.g. a full-index fetch that bypasses the entry
cache entirely, like HttpCache::get_transport_only_with_headers_limited — can
request one without touching the shared constant every other registry client
relies on.
§Examples
use deps_core::cache::BodyLimit;
let default_limit = BodyLimit::DEFAULT;
let clamped = BodyLimit::new(usize::MAX);
assert_ne!(clamped, default_limit);Implementations§
Trait Implementations§
impl Copy for BodyLimit
impl Eq for BodyLimit
impl StructuralPartialEq for BodyLimit
Auto Trait Implementations§
impl Freeze for BodyLimit
impl RefUnwindSafe for BodyLimit
impl Send for BodyLimit
impl Sync for BodyLimit
impl Unpin for BodyLimit
impl UnsafeUnpin for BodyLimit
impl UnwindSafe for BodyLimit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.