2 ms·
You use an attribute, "#[must_use]". I haven't seen code not use the standard Result type, and I don't think it's likely. First of all, it's generic, so you ar
by pcwalton 13y ago
You use an attribute, "#[must_use]".
I haven't seen code not use the standard Result type, and I don't think it's likely. First of all, it's generic, so you aren't forced into a set of errors or an interface that you have to conform to—there's no reason not to use it. Second, there's strong pressure to use Result: all of the standard libraries use that type, so you'd have to write a lot of code to convert back and forth between your own error type and Result if you wanted to create your own for some reason. It'd also be less convenient from an import point of view: you'd always have to import your custom Result everywhere, whereas Result is always available right there in the prelude. Plus, you get really convenient "try!" macro sugar if you use Result. All of this means that you'd really have to go out of your way to not use Result, and my experience matches this.