pub trait IsDefault {
// Required method
fn is_default(&self) -> bool;
}Expand description
Checks whether a value is equal to its type’s default.
Required Methods§
Sourcefn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is equal to the default value for its type.
Implementations must ensure that the condition self == &Self::default() holds.
Implementations on Foreign Types§
Source§impl IsDefault for PhantomPinned
impl IsDefault for PhantomPinned
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Always returns true.
Source§impl IsDefault for AtomicBool
impl IsDefault for AtomicBool
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is false.
Source§impl IsDefault for AtomicIsize
impl IsDefault for AtomicIsize
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is 0isize.
Source§impl IsDefault for AtomicUsize
impl IsDefault for AtomicUsize
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is 0usize.
Source§impl<K, V> IsDefault for BTreeMap<K, V>
impl<K, V> IsDefault for BTreeMap<K, V>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<K, V> IsDefault for HashMap<K, V>
impl<K, V> IsDefault for HashMap<K, V>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<T> IsDefault for Cow<'_, T>
impl<T> IsDefault for Cow<'_, T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Source§impl<T> IsDefault for Option<T>
impl<T> IsDefault for Option<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is None.
Source§impl<T> IsDefault for [T]where
T: IsDefault,
impl<T> IsDefault for [T]where
T: IsDefault,
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if:
- slice is empty
- all slice elements is default
Source§impl<T> IsDefault for Box<T>
impl<T> IsDefault for Box<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Source§impl<T> IsDefault for BinaryHeap<T>
impl<T> IsDefault for BinaryHeap<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<T> IsDefault for BTreeSet<T>
impl<T> IsDefault for BTreeSet<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<T> IsDefault for LinkedList<T>
impl<T> IsDefault for LinkedList<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<T> IsDefault for VecDeque<T>
impl<T> IsDefault for VecDeque<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<T> IsDefault for Rc<T>
impl<T> IsDefault for Rc<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Source§impl<T> IsDefault for Arc<T>
impl<T> IsDefault for Arc<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Source§impl<T> IsDefault for Vec<T>
impl<T> IsDefault for Vec<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<T> IsDefault for OnceCell<T>
impl<T> IsDefault for OnceCell<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is uninitialized.
Source§impl<T> IsDefault for Cell<T>
impl<T> IsDefault for Cell<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Source§impl<T> IsDefault for Ref<'_, T>
impl<T> IsDefault for Ref<'_, T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if T is default.
Source§impl<T> IsDefault for RefCell<T>
impl<T> IsDefault for RefCell<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Always return false if self.try_borrow() returns an error.
Source§impl<T> IsDefault for RefMut<'_, T>
impl<T> IsDefault for RefMut<'_, T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if T is default.
Source§impl<T> IsDefault for Wrapping<T>where
T: IsDefault,
impl<T> IsDefault for Wrapping<T>where
T: IsDefault,
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Source§impl<T> IsDefault for HashSet<T>
impl<T> IsDefault for HashSet<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is empty.
Source§impl<T> IsDefault for Cursor<T>
impl<T> IsDefault for Cursor<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if cursor position is 0.
Source§impl<T> IsDefault for OnceLock<T>
impl<T> IsDefault for OnceLock<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if self is uninitialized.
Source§impl<T> IsDefault for Mutex<T>
impl<T> IsDefault for Mutex<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Always return false if self.try_lock() returns an error.
Source§impl<T> IsDefault for RwLock<T>
impl<T> IsDefault for RwLock<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the inner value is default.
Always return false if self.try_read() returns an error.
Source§impl<T, const N: usize> IsDefault for [T; N]where
T: IsDefault,
impl<T, const N: usize> IsDefault for [T; N]where
T: IsDefault,
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true:
- for array [T; 0]
- if all array elements is default
Source§impl<T: IsDefault> IsDefault for (T,)
This trait is implemented for tuples up to twelve items long.
impl<T: IsDefault> IsDefault for (T,)
This trait is implemented for tuples up to twelve items long.
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if all tuple fields is default.
Source§impl<T: ?Sized> IsDefault for Weak<T>
impl<T: ?Sized> IsDefault for Weak<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the Weak::upgrade returns None.
Source§impl<T: ?Sized> IsDefault for Weak<T>
impl<T: ?Sized> IsDefault for Weak<T>
Source§fn is_default(&self) -> bool
fn is_default(&self) -> bool
Returns true if the Weak::upgrade returns None.