diff options
Diffstat (limited to 'library/core/src/unit.rs')
| -rw-r--r-- | library/core/src/unit.rs | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/library/core/src/unit.rs b/library/core/src/unit.rs index d656005f3d4..d54816c444b 100644 --- a/library/core/src/unit.rs +++ b/library/core/src/unit.rs @@ -17,3 +17,19 @@ impl FromIterator<()> for () { iter.into_iter().for_each(|()| {}) } } + +pub(crate) trait IsUnit { + fn is_unit() -> bool; +} + +impl<T: ?Sized> IsUnit for T { + default fn is_unit() -> bool { + false + } +} + +impl IsUnit for () { + fn is_unit() -> bool { + true + } +} | 
