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

Function update_question

ch_06/src/routes/question.rs:30–41  ·  view source on GitHub ↗
(
    id: String,
    store: Store,
    question: Question,
)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

QuestionIdClass · 0.50

Tested by

no test coverage detected