From: Ian Jackson Date: Mon, 6 Jul 2020 15:23:18 +0000 (+0100) Subject: move implementation into generic, prep for reorg X-Git-Tag: otter-0.2.0~1425 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=695eb961bda5a7d62645637f3192db1c5c19faba;p=otter.git move implementation into generic, prep for reorg --- diff --git a/src/bin/server.rs b/src/bin/server.rs index 77ec29b8..80c2018e 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -125,14 +125,13 @@ struct ApiPiece { #[derive(Debug,Serialize,Deserialize)] struct ApiPieceGrab { } -trait ApiPieceOp { +trait ApiPieceOp : Debug { } impl ApiPieceOp for ApiPieceGrab { } -#[post("/_/api/grab", format="json", data="
")] #[throws(OE)] -fn api_grab(form : Json>) - -> impl response::Responder<'static> { +fn api_piece_op(form : Json>) + -> impl response::Responder<'static> { let iad = lookup_token(&form.ctoken)?; let client = iad.ident; let mut g = iad.g.lock()?; @@ -204,6 +203,13 @@ fn api_grab(form : Json>) "" } +#[post("/_/api/grab", format="json", data="")] +#[throws(OE)] +fn api_grab(form : Json>) + -> impl response::Responder<'static> { + api_piece_op(form) +} + #[derive(Debug,Serialize,Deserialize)] struct ApiUngrab { t : String,