smart-serde-default

Crates.iosmart-serde-default
lib.rssmart-serde-default
version0.1.1
sourcesrc
created_at2024-06-21 22:17:22.937637
updated_at2024-06-21 22:20:24.580242
descriptionAn annotation to implement #[serde(default)] and Default.
homepage
repositoryhttps://github.com/enzious/smart-serde-default
max_upload_size
id1280006
size6,840
enzious (enzious)

documentation

https://docs.rs/smart-serde-default

README

smart-serde-default

License Contributors GitHub Repo stars crates.io

A crate that basically extends the serde-inline-default and smart-default crates functionality to allow you to specify a default for both std::default::Default and serde with one annotation.

Documentation

Defining defaults

#[smart_serde_default]
#[derive(Debug, Deserialize, Serialize, SmartDefault)]
pub struct FuzionRedisConfigBuilder {
  #[smart_default(String::from("127.0.0.1"))]
  host: String,

  #[smart_default(6379)]
  port: u16,
}
Commit count: 2

cargo fmt