From 695eb961bda5a7d62645637f3192db1c5c19faba Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 6 Jul 2020 16:23:18 +0100 Subject: [PATCH] move implementation into generic, prep for reorg --- src/bin/server.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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, -- 2.30.2