aboutsummaryrefslogtreecommitdiff
path: root/mingling_picker/src/picker.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-17 08:48:29 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-17 08:48:29 +0800
commit80c66d1efc9babfc1991edc023b06adad680edbb (patch)
tree795cc302b60d369c82054f4bbc5d69efcadfa4f1 /mingling_picker/src/picker.rs
parentdeb87d8f8dfa242663bf9ab9a90c868585fc85da (diff)
feat(picker): expose internal fields and add `IntoPicker` for
`&Vec<String>` Make `route_phantom` and `args` fields `pub(crate)` for internal reuse. Fix error route conversion by adding `.into()` call. Implement `IntoPicker` for `&Vec<String>` to support passing string references.
Diffstat (limited to 'mingling_picker/src/picker.rs')
-rw-r--r--mingling_picker/src/picker.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/mingling_picker/src/picker.rs b/mingling_picker/src/picker.rs
index 69b1671..81fb10a 100644
--- a/mingling_picker/src/picker.rs
+++ b/mingling_picker/src/picker.rs
@@ -12,10 +12,10 @@ use crate::{Pickable, PickerArg, PickerArgResult};
#[doc = include_str!("../README.md")]
pub struct Picker<'a, Route = ()> {
- route_phantom: PhantomData<Route>,
+ pub(crate) route_phantom: PhantomData<Route>,
/// Internal arguments of Picker
- args: PickerArgs<'a>,
+ pub(crate) args: PickerArgs<'a>,
}
impl<'a> Picker<'a> {
@@ -344,6 +344,16 @@ impl<'a> IntoPicker<'a> for Vec<&'a str> {
}
}
+impl<'a> IntoPicker<'a> for &'a Vec<String> {
+ fn to_picker(self) -> Picker<'a, ()> {
+ let slice: Vec<&str> = self.iter().map(|s| s.as_str()).collect();
+ Picker {
+ route_phantom: PhantomData,
+ args: PickerArgs::Vec(slice),
+ }
+ }
+}
+
impl<'a> IntoPicker<'a> for Vec<String> {
fn to_picker(self) -> Picker<'a, ()> {
Picker {