Skip to main content

validate_begin_num

Function validate_begin_num 

pub fn validate_begin_num(
    begin: i32,
    num: i32,
    max_num: i32,
    endpoint: &str,
) -> Result<PageBounds, PageBoundsError>
Expand description

Validate (begin, num) pagination parameters.

Rules:

  • begin >= 0
  • 0 <= num <= max_num

num = 0 is intentionally valid and represents an empty page request, which matches the audited C++/backend behavior for the affected endpoints.