MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / update_question

Function update_question

ch_05/src/routes/question.rs:24–35  ·  view source on GitHub ↗
(
    id: String,
    store: Store,
    question: Question,
)

Source from the content-addressed store, hash-verified

22}
23
24pub async fn update_question(
25 id: String,
26 store: Store,
27 question: Question,
28) -> Result<impl warp::Reply, warp::Rejection> {
29 match store.questions.write().await.get_mut(&QuestionId(id)) {
30 Some(q) => *q = question,
31 None => return Err(warp::reject::custom(Error::QuestionNotFound)),
32 }
33
34 Ok(warp::reply::with_status("Question updated", StatusCode::OK))
35}
36
37pub async fn delete_question(
38 id: String,

Callers

nothing calls this directly

Calls 1

QuestionIdClass · 0.50

Tested by

no test coverage detected