Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop breaking type coercion #25

Open
elichai opened this issue Jul 4, 2020 · 1 comment
Open

Stop breaking type coercion #25

elichai opened this issue Jul 4, 2020 · 1 comment

Comments

@elichai
Copy link
Owner

elichai commented Jul 4, 2020

The current way we match over the result breaks type coercion, example:

example this will break: (https://play.rust-lang.org/?gist=487d56225ce4b06116eb357f75bf6474)

#[logfn(INFO)]
fn first() -> Result<u8, Box<dyn Error>> {
    Err(Box::new(MyError))
}

Possible solutions:

  • Use match instead of map/map_err (this complicates no-std support, see Don't rely on Ok or Err for logging Results #7)
  • Use the ? operator, (ie Ok(expr?)), but this again complicates no-std support because Ok is a prelude that might not always be in scope
@Quba1
Copy link

Quba1 commented Nov 3, 2021

If the possible solution is merged might this issue be now closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants