• 0 Posts
  • 1 Comment
Joined 5 years ago
cake
Cake day: May 19th, 2021

help-circle
  • You are running into the Send Approximation being too conservative. The compiler does not like to see a let binding for a non-Send type and an .await statement in the same scope. It is not (yet) smart enough to know that the non-Send type is already consumed by the time of the .await.

    You’ve already discovered the workaround in your three(). To make it more concise

    async fn four() {
        let content = do_stuff().err().map(|err| err.to_string());
        if let Some(content) = content {
            let _ = do_stuff_2(content).await;
        }
    }