Skip to main content

get_usize

Function get_usize 

Source
pub fn get_usize(args: &Map<String, Value>, key: &str) -> Option<usize>
Expand description

Read a non-negative integer argument as usize.

Returns None for missing or negative values. This avoids the negative_i64 as usize wrap to usize::MAX, which previously let an agent trigger unbounded allocations (e.g. top_k, limit, max_results) → OOM. Callers should still apply a sensible upper cap on the result.