3 ms·
> But that being said, the function call only happens in the error path, when returning an error from a function, right? std::ops::Try looks like: - fn into_re
by wallacoloo 7y ago
> But that being said, the function call only happens in the error path, when returning an error from a function, right?
std::ops::Try looks like:
- fn into_result(self) -> Result<Self::Ok, Self::Error>; // called on `x` whenever you use the `x?` syntax.
- fn from_error(v: Self::Error) -> Self;
- fn from_ok(v: Self::Ok) -> Self;
It's been a while since I explored this. I was thinking you'd `#[inline(always)]` the `into_result` method, but now that I look at the trait again, I think you would only force inline the `from_error` method and it should still work but without impacting the non-error path much.