3 ms·
pardon my ignorance, but in the last line, how does json::decode knows it should decode to a json::DecodeResult<Point> rather than a json::DecodeResult<Whatever
by riffraff 12y ago
pardon my ignorance, but in the last line, how does json::decode knows it should decode to a json::DecodeResult<Point> rather than a json::DecodeResult<Whatever> ?
- eridius 12y agoBecause of the type annotation on the `x` declaration. Rust takes type constraints on the result type into account when determining what implementation to call.