Skip to main content

check_alloc_bound

Function check_alloc_bound 

Source
pub fn check_alloc_bound(bytes: usize) -> Result<()>
Expand description

Validates that a requested allocation of bytes is within the configured ceiling, without allocating.

Lets callers reject pathological sizes before building a Layout or reserving a Vec. Thread this in front of resize / gather / reorder paths.

ยงErrors

Returns Error::AllocationFailed if bytes exceeds alloc_byte_limit.