I'm using the serde_json
crate and have to make a type annotation for the return value of serde_json::from_slice()
. If I use a let
and a match
statement afterwards, this works
let n: Result<serde_json::Value, serde_json::Error> = serde_json::from_slice(buf);
match n {
Ok(_i) => (),
Err(_e) => (),
};
But as I don't need n
, I don't want to make the let
statement in the first place, and only use a single match pattern. How can I make the type annotation for _i
?