I think the only operator that would make sense is ||
. It’s already lazy, as this one would be, and currently isn’t overloadable so it wouldn’t break anything. (And you can imagine a impl Try for bool
where b?
short-circuits on false which would be perfectly consistent with this definition, though I suspect we don’t actually want to allow ?
on bool
.)
OTOH, maybe just the macro would be enough. A bunch of the try{}
discussions have talked about “what if I just want to return the first success?”, where it might be good not to have that use try
/?
, but instead use something like
coalesce!(
fetch_from_primary(),
fetch_from_secondary(),
Err(NotFoundInEither),
)