bynk.types.ok_value_mismatch
Error An Ok payload has the wrong type.
Ok(v) takes its type from where it is used. A return type or annotation of Result[T, E] fixes T, so Ok("12") where T is Int is refused at the value, with no conversion; so is a value that does not match an HttpResult[T] handler's T. Pass a T, or change the declared type. The error half is bynk.types.err_value_mismatch; with nothing to fix T, it is bynk.types.cannot_infer_result_type_params.
Example
fn total() -> Result[Int, String] { Ok("12") // ✗ a `String`, where `Int` is expected}
fn total() -> Result[Int, String] { Ok(12) // ✓}In the Book
See also
- The grammar rule it governs:
ok_expr. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.ok_value_mismatchshows the same from the installed toolchain, without a network.