Skip to main content

coerce

Function coerce 

Source
pub fn coerce(name: &str, kind: ParamType, value: &Value) -> CliResult<Value>
Expand description

Coerce a caller-supplied value to the declared type.

Deliberately lenient about representation (a CLI --param n=5 and an HTTP {"n": 5} must behave identically) and strict about type (int never silently accepts 1.5). Never accepts null: a param either has a value or falls back to its default.