I don't understand how Result<()> works

The Result<T, E>, takes two types T and E to work. But this example from the std lib broke my understanding. I mean if they used like Result<(), _>, I can get it the error type is inferred. But, how does this Result<()> work? What will be its error type?

The io::Result thing is a type alias that is defined like this:

type Result<T> = std::result::Result<T, std::io::Error>;
3 Likes

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.