Hacker News new | past | comments | ask | show | jobs | submit login

You can annotate the return type inside the closure in those cases, for example:

    let x = || async {
        let file = std::fs::read_to_string("foo.txt")?;
        Ok::<_, Box<dyn std::error::Error>>(file)
    };



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: