docs: add README as library documentation

This commit is contained in:
bytedream 2023-02-11 18:51:49 +01:00
parent 81b089be37
commit d8a0dff1af
2 changed files with 3 additions and 1 deletions

View File

@ -4,7 +4,7 @@ Tiny crate to set default values for serde fields via inline attribute declarati
## Overview ## Overview
This crate is an approach to do what serde-rs/serde#368 purposes. This crate is an approach to do what [serde-rs/serde#368](https://github.com/serde-rs/serde/issues/368) purposes.
If you want to set default values in plain [`serde`](https://serde.rs/), you have to create a function and link to it with `#[serde(default = "...")`. If you want to set default values in plain [`serde`](https://serde.rs/), you have to create a function and link to it with `#[serde(default = "...")`.
This may be good if you need to do calculations to get the default value, but often you just want a simple integer or string to be the default value and have to create a whole function to return a hard-coded value. This may be good if you need to do calculations to get the default value, but often you just want a simple integer or string to be the default value and have to create a whole function to return a hard-coded value.
```rust ```rust

View File

@ -1,3 +1,5 @@
#![doc = include_str!("../README.md")]
use proc_macro::TokenStream; use proc_macro::TokenStream;
use syn::{parse_macro_input, Item}; use syn::{parse_macro_input, Item};