On Tue, Dec 20, 2016, at 09:46 PM, Jan de Mooij wrote: > A few weeks ago we added mozilla::Result<V, E> to MFBT [0][1]. I was > asked > to inform dev-platform about this, so here's a quick overview. > mozilla::Result<V, E> is based on Rust's Result type [2]. It contains > either a success value of type V or an error value of type E.
I want to write a function that either returns an object that has already been AddRefed or an nsresult error. Result<already_AddRefed<...>, nsresult> doesn't seem to work. Result<RefPtr<...>, nsresult> would presumably work, but might wastefully touch the object's refcount. Is there a better way? _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform