From e0bda48608bc9bfba726071c1884fc6a8a54e360 Mon Sep 17 00:00:00 2001 From: kanarus Date: Sun, 1 Sep 2024 04:49:30 +0900 Subject: [PATCH] chore: update README (#14) --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ed0c67b..aeb753e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@
- Just a wrapper of serde, serde_derive and 100% compatible -- Validation on deserializing with `#[serde(validate = "...")]` +- Auto validation in deserialization by `#[serde(validate = "...")]`
@@ -22,7 +22,6 @@
- ## Example ```toml @@ -67,17 +66,19 @@ fn main() { } ``` +Of course, you can use it in combination with some validation tools like
validator! ( full example ) + ## Attribute - `#[serde(validate = "function")]` - Perform validation by the function just after deserializing finished. The function must be callable as `fn(&self) -> Result<(), impl Display>`.\ + Perform validation by the function just after deserializing finished. The `function` must be callable as `fn(&self) -> Result<(), impl Display>`.\ Currently, errors are converted to `String` internally and passed to `serde::de::Error::custom`. - `#[serde(validate(by = "function", error = "Type"))]` - Use given `Type` for validation error without internal conversion. The function must explicitly return `Result<(), Type>`.\ + Using given `Type` for validation error without internal conversion. The `function` must explicitly return `Result<(), Type>`.\ This may be preferred when you need better performance _even in error cases_.\ For **no-std** use, this is the only way supported. @@ -86,4 +87,4 @@ Both `"function"` and `"Type"` accept path like `"crate::utils::validate"`. ## License -Licensed under MIT LICENSE ( [LICENSE](https://github.com/ohkami-rs/serdev/blob/main/LICENSE) or [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) ). \ No newline at end of file +Licensed under MIT LICENSE ( [LICENSE](https://github.com/ohkami-rs/serdev/blob/main/LICENSE) or [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) ).