1 unstable release
0.1.0 | Nov 8, 2020 |
---|
#2928 in Rust patterns
517 downloads per month
Used in 2 crates
7KB
default-ext
This library provides extension methods for the Default
trait.
Example
case1:
use default_ext::DefaultExt;
assert!(false.is_default());
case2:
#[derive(serde::Serialize, serde::Deserialize)]
struct Object {
#[serde(
default,
skip_serializing_if = "default_ext::DefaultExt::is_default",
)]
is_test: bool,
}
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
lib.rs
:
This library provides extension methods for the Default
trait.
Example
case1:
assert!(false.is_default());
case2:
#[derive(serde::Serialize, serde::Deserialize)]
struct Object {
#[serde(
default,
skip_serializing_if = "default_ext::DefaultExt::is_default",
)]
is_test: bool,
}