Relative Content

Tag Archive for rustasync-awaitrust-tokiorust-axum

Why isn’t it possible to chain .await in certain situations?

async fn get_students_with_upcoming_exam( State(state): State<Arc<AppState>>, Query(in_days): Query<u8> ) -> impl IntoResponse { // let students = state.state.read().await.students_with_upcoming_exam(in_days); let students_lock = state.state.read().await; let students = students_lock.students_with_upcoming_exam(in_days); (StatusCode::OK, Json(json!(students))) } In my axum handler I’m trying to use the students_with_upcoming_exam(u8) function which just filters the Vec of students on my shared state, which is DrivingSchool. For some […]

Why isn’t it possible to chain await in certain situations with rust

async fn get_students_with_upcoming_exam( State(state): State<Arc<AppState>>, Query(in_days): Query<u8> ) -> impl IntoResponse { // let students = state.state.read().await.students_with_upcoming_exam(in_days); let students_lock = state.state.read().await; let students = students_lock.students_with_upcoming_exam(in_days); (StatusCode::OK, Json(json!(students))) } In my axum handler I’m trying to use the students_with_upcoming_exam(u8) funciton which just filters the Vec of students on my shared state, which is DrivingSchool. For some […]