Thanks both for the clarifications.
There is a use case that I'd like to clarify the performance + sanity of. I hope discussion here will be useful to others looking to use Result, but please let me know if it's more suitable to take elsewhere. In the Media stack I often want to return a Result<SomePotentiallyLargeBlob, nsCString or MediaResult>. In the Ok case we're passing around potentially large pieces of media, in the Err case we have a verbose error that we'd like logged. In either case the Result may need to go through several stack frames before it's logged or consumed. This seems like an ideal use case for Result to me. In the Err case, it looks like with the up coming changes[0] the error will be copied into the Result? I'm not entirely sure I understand the Ok case given what was said above. > But either way, that's going to result in a copy when > the Result is constructed (unless the compiler is really clever). Is it the data being moved into the Result which is incurring the copy here, or the actual Result that's being returned? I would have thought that the data is moved into the Result avoids a copy, then the Result itself would be moved or RVOed (either way avoiding a copy). [0]: https://phabricator.services.mozilla.com/D41425 _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform