Skip to content

Why can't use both ".await?" and "rand::rng"? (-> Result<Response, Response>) #3366

Closed Answered by raphael1233333
raphael1233333 asked this question in Q&A
Discussion options

You must be logged in to vote

Fixed this way:

axum = { version = "0.8.4", features = ["macros"] }

fn create_rng()
{
    let rng: rand::prelude::ThreadRng = rand::rng();
}

#[axum::debug_handler]
async fn handler()
-> Result<Response, Response>
{
    create_rng();

    testfunc().await?;
    
    return Ok((StatusCode::OK, "test").into_response());
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@raphael1233333
Comment options

@mladedav
Comment options

@raphael1233333
Comment options

Answer selected by jplatte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants