Skip to main content

require_positive_bounded_u32

Function require_positive_bounded_u32 

Source
pub fn require_positive_bounded_u32<E>(
    value: u32,
    cap: u32,
    on_zero: impl FnOnce() -> E,
    on_cap_exceeded: impl FnOnce(u32) -> E,
) -> Result<(), E>
Expand description

Named u32 delegate onto the generic require_positive_bounded entry-point — preserved so the six pre-lift u32 call sites continue to compile at their original site-shape and the diagnostic on a mis-typed cap argument still names u32 explicitly (expected u32, found u64) rather than the generic entry-point’s less-directed “type annotations needed for BoundedInteger” diagnostic. Delegates verbatim; no arm-ordering or gate-shape divergence between this named sibling and the generic body.

§Errors

Returns on_zero() for value == 0; returns on_cap_exceeded(value) for value > cap; returns Ok(()) otherwise.