MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / clamp_limit

Function clamp_limit

crates/openshell-server/src/grpc/mod.rs:71–73  ·  view source on GitHub ↗

Clamp a client-provided page `limit`. Returns `default` when `raw` is 0 (the protobuf zero-value convention), otherwise returns the smaller of `raw` and `max`.

(raw: u32, default: u32, max: u32)

Source from the content-addressed store, hash-verified

69/// Returns `default` when `raw` is 0 (the protobuf zero-value convention),
70/// otherwise returns the smaller of `raw` and `max`.
71pub fn clamp_limit(raw: u32, default: u32, max: u32) -> u32 {
72 if raw == 0 { default } else { raw.min(max) }
73}
74
75/// Map a `PersistenceError` to an appropriate gRPC `Status`.
76///

Callers 5

handle_list_sandboxesFunction · 0.85
handle_list_providersFunction · 0.85
handle_list_servicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected