From 47fe4a8ef02992be97fd4fc8371377fcd29de24e Mon Sep 17 00:00:00 2001 From: Dmitrii Demenev Date: Wed, 11 Sep 2024 18:06:07 -0600 Subject: [PATCH 1/2] implemented IsEmpty for () --- is_empty/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/is_empty/src/lib.rs b/is_empty/src/lib.rs index bfb37b8..5a79413 100644 --- a/is_empty/src/lib.rs +++ b/is_empty/src/lib.rs @@ -106,6 +106,12 @@ impl IsEmpty for std::option::Option { } } +impl IsEmpty for () { + fn is_empty(&self) -> bool { + true + } +} + /// Thin wrapper function around [IsEmpty::is_empty]. Use it with serde's skip_serializing_if attribute. /// ``` /// use is_empty::IsEmpty; From 31e52acde17b1880d5c94a6888154a374bb56625 Mon Sep 17 00:00:00 2001 From: Dmitrii Demenev Date: Tue, 17 Sep 2024 14:44:35 -0600 Subject: [PATCH 2/2] Added an impl of IsEmpty for Vec --- is_empty/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/is_empty/src/lib.rs b/is_empty/src/lib.rs index 5a79413..58ac03e 100644 --- a/is_empty/src/lib.rs +++ b/is_empty/src/lib.rs @@ -112,6 +112,12 @@ impl IsEmpty for () { } } +impl IsEmpty for Vec { + fn is_empty(&self) -> bool { + self.is_empty() + } +} + /// Thin wrapper function around [IsEmpty::is_empty]. Use it with serde's skip_serializing_if attribute. /// ``` /// use is_empty::IsEmpty;