aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-16 23:45:03 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-16 23:45:03 +0800
commit06d31f314ef9f1546ef70e9f1d082c4f1fd49cdf (patch)
tree5342aa14b62eb7a3f8c0907a026427f7cc5325f0
parent0fff7a0663a8794bed9cd7659226e522da4e34d0 (diff)
feat(picker): add with_route method to change phantom route type
-rw-r--r--mingling_picker/src/picker.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/mingling_picker/src/picker.rs b/mingling_picker/src/picker.rs
index 4473d76..4efb532 100644
--- a/mingling_picker/src/picker.rs
+++ b/mingling_picker/src/picker.rs
@@ -47,6 +47,22 @@ impl<'a> Picker<'a> {
args: PickerArgs::Owned(args),
}
}
+
+ /// Changes the route (phantom type parameter) of the `Picker`.
+ ///
+ /// This method allows converting a `Picker` from one route type to another,
+ /// while preserving the same underlying arguments. The route type is typically
+ /// used to distinguish different parsing contexts or to carry compile-time
+ /// state information through the picking chain.
+ pub fn with_route<NewRoute>(self) -> Picker<'a, NewRoute>
+ where
+ Self: Sized,
+ {
+ Picker {
+ route_phantom: PhantomData,
+ args: self.args,
+ }
+ }
}
/// Internal arguments of Picker