Error conversion in tokio-serde: Why does this work?

I'm trying to get tokio-serde to work in a program I'm writing, and along the way I've found that I don't understand why the example code compiles. According to the documentation, tokio-serde's Framed can only serve as a Sink or Stream if Codec::Error can be converted Into Transport::Error. In the case of, say, the example:

Now, I see that serde_json::Error implements conversion to std::io::Error, but how do we get from that to a LengthDelimitedCodecError? I must be missing something in the documentation for one of these types, but I (obviously) don't see what.

It isn't; it's io::Error: docs

(Not sure if that's the docs link you meant to provide, but this seems like a better link.)

I see. So LengthDelimitedCodecError isn't a "top-level" Error type but rather used as the error payload to io::Error::new(). Odd.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.