1#![doc = include_str!("../README.md")]
2#![cfg_attr(not(feature = "std"), no_std)]
3#![cfg_attr(feature = "ascii_char", feature(ascii_char, ascii_char_variants))]
4#![cfg_attr(feature = "bstr", feature(bstr))]
5#![cfg_attr(feature = "f16", feature(f16))]
6#![cfg_attr(feature = "f128", feature(f128))]
7
8#[cfg(feature = "derive")]
9extern crate is_default_derive;
10#[cfg(feature = "derive")]
11pub use is_default_derive::IsDefault;
12
13pub trait IsDefault {
15 fn is_default(&self) -> bool;
19}
20
21#[cfg(not(feature = "via_default_eq"))]
22mod not_via_default_eq;
23
24#[cfg(feature = "via_default_eq")]
25mod via_default_eq {
26 use crate::IsDefault;
27
28 impl<T> IsDefault for T
29 where
30 T: Default + PartialEq,
31 {
32 fn is_default(&self) -> bool {
33 self == &Self::default()
34 }
35 }
36}