From 8a22b390ac6b7ab538550facbcaed6d1bfb6172e Mon Sep 17 00:00:00 2001 From: Franklin Date: Sun, 25 Sep 2022 11:15:35 -0400 Subject: [PATCH] Added documentation --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index f58379e..f3d8579 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,11 @@ use std::fmt::Display; use serde::{Serialize, Deserialize}; +/// This is for sending errors back from requests conveniently. +/// This struct contains an optional key just in +/// case you want to deal with internationalization. +/// It was left as optional just in case you don't +/// have the time to yet... #[derive(Serialize, Deserialize, Debug, Clone)] pub struct MessageResource { pub key: Option, @@ -35,6 +40,8 @@ impl Default for MessageResource{ } } +/// This is supposed to be used whenever you have an error in your code and want to be more specific about it. +/// Fits in with most CRUD web apps. What you send back to the client is a MessageResource, not the error itself! #[derive(Debug, Clone)] pub enum Error { Network(MessageResource),