RFC 243 proposed the
? operator as a replacement for the
try! macro. That RFC was accepted and the
? operator is in nightly Rust. Part of the RFC which was not accepted was the idea of a
ResultCarrier) trait which abstracts over
Option, and users’ custom result types. The language team felt that such a trait was a good idea, but that we needed to experiment with it before accepting it via the RFC process. Unfortunately we were not explicit about how that experimentation was to be done and the process for acceptance into the language.
I have recently done the implementation work in PR 33389. The intention is that the implementation will evolve through use and feedback, and that the current implementation will not be the final one. The language team has decided that we should merge this PR for the sake of experimentation, and on the understanding that it will go through a rigorous period of examination and FCP before being stabilised. Furthermore, if it proves to be contentious, then we will open an amendment RFC before stabilisation.
Please try out this feature and let us know what you think on the tracking issue. Some specific areas we are interested in:
- overall, does the feature pull its weight?
- what name should the trait should have?
- how it feels using
- whether the trait is flexible enough (we’re pretty sure it isn’t yet, see for example this comment)
- should the trait be implemented for
bool? (We think probably not, but curious if there are good use cases).
- what else is missing?