aboutsummaryrefslogtreecommitdiff
path: root/mingling_picker/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-14 01:49:39 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-14 01:49:39 +0800
commit62f6b476284da67efc55483a81b57f99a478702a (patch)
treeb9cf2376700a7016d3ff76d527598d6b8c4b841a /mingling_picker/src
parent5547ebe21f4595c03a965cd068c72b27801b2070 (diff)
feat(picker): add `is_empty` method and refactor `if let` chains
Refactor multiple `if let` patterns in macros to use the let-chain syntax for improved readability
Diffstat (limited to 'mingling_picker/src')
-rw-r--r--mingling_picker/src/picker.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/mingling_picker/src/picker.rs b/mingling_picker/src/picker.rs
index f8d3cb1..01bebc7 100644
--- a/mingling_picker/src/picker.rs
+++ b/mingling_picker/src/picker.rs
@@ -81,6 +81,23 @@ impl<'a> Picker<'a> {
}
}
+ /// Returns `true` if the picker contains no arguments.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use mingling_picker::Picker;
+ ///
+ /// let empty: Picker = Picker::from(&[][..]);
+ /// assert!(empty.is_empty());
+ ///
+ /// let args = Picker::from(&["hello"][..]);
+ /// assert!(!args.is_empty());
+ /// ```
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
/// Returns an iterator over the arguments, yielding owned `String` values.
///
/// # Examples