From a3c7204cd22dac48dd8e79d5bed692f3bdd3c25f Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Wed, 5 Sep 2018 22:42:45 -0400 Subject: [PATCH] Fix outdated comments in util.rs about the reply format The reply format used to only have the `data` and `errors` keys in the root level, but that has since been changed. Signed-off-by: Mcat12 --- src/util.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util.rs b/src/util.rs index a056e8618..1cc24ca3f 100644 --- a/src/util.rs +++ b/src/util.rs @@ -45,14 +45,13 @@ pub fn reply(data: ReplyType, status: Status) -> Reply { Ok(SetStatus(Json(json_data), status)) } -/// Create a reply from some serializable data. The reply will contain no -/// errors and will have a status code of 200. +/// Create a reply from some serializable data. The reply will have a status +/// code of 200. pub fn reply_data(data: D) -> Reply { reply(ReplyType::Data(data), Status::Ok) } -/// Create a reply with an error. The data will be an empty array and the -/// status will taken from `error.status()`. +/// Create a reply with an error. The status will taken from `error.status()`. pub fn reply_error>(error: E) -> Reply { let error = error.into(); let status = error.status(); @@ -65,6 +64,7 @@ pub fn reply_success() -> Reply { reply(ReplyType::Data(json!({ "status": "success" })), Status::Ok) } +/// The type of reply which should be sent. pub enum ReplyType { Data(D), Error(Error)