base_traits/traits/is_default.rs
1// src/traits/is_default.rs : `IsDefault`
2
3/// Trait defining instance method `is_default() : bool` that allows a type
4/// instance to indicate whether it holds the "default" value.
5pub trait IsDefault {
6 fn is_default(&self) -> bool;
7}
8
9
10#[cfg(all(not(test), not(feature = "nostd")))]
11impl<T : IsDefault + ?Sized> IsDefault for Box<T> {
12 fn is_default(&self) -> bool {
13 (**self).is_default()
14 }
15}
16
17#[cfg(all(not(test), not(feature = "nostd")))]
18impl<T : IsDefault + ?Sized> IsDefault for std::rc::Rc<T> {
19 fn is_default(&self) -> bool {
20 (**self).is_default()
21 }
22}
23
24
25// ///////////////////////////// end of file //////////////////////////// //
26