aboutsummaryrefslogtreecommitdiff
path: root/CHANGELOG.md
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-04-28 09:13:12 +0800
committer魏曹先生 <1992414357@qq.com>2026-04-28 09:13:12 +0800
commit7610a6f53f835995b06c9c623fbca1d188f07544 (patch)
tree32e2eb2f56aea2e037d93d76676741da96e78230 /CHANGELOG.md
parent2c32196bbc632411d4f6998a506ca262a805a666 (diff)
Simplify Picker API by removing generic parameter and route types
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r--CHANGELOG.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0997e27..8682c5a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -135,6 +135,32 @@ use mingling::marker::NextProcess; // Remove this
gen_program!();
```
+6. **\[picker\]** Simplified `Picker` logic:
+
+ - `Picker` no longer requires the generic parameter `<G>` by default; it only needs it when using `pick_or_route` or `after_or_route`
+
+ - Additionally, if no `or_route` operations are used, the `unpack_directly` function is no longer available; `unpack` will directly extract the inner value
+
+```rust
+// Before
+let (name, age) = Picker::<()>::new(prev.inner) // had to specify an arbitrary type even for routers Picker without routes
+ .pick::<String>(())
+ .pick::<i32>(())
+ .unpack_directly(); // had to use `unpack_directly` to get the inner value
+
+// After
+let (name, age) = Picker::new(prev.inner) // no longer need to specify an unused route type
+ .pick::<String>(())
+ .pick::<i32>(())
+ .unpack(); // no longer need to use `unpack_directly`
+
+// But ...
+let (name, age) = Picker::new(prev.inner)
+ .pick::<String>(())
+ .pick_or_route::<i32>((), NoNumberProvided::default().to_render()) // if a route type is specified
+ .unpack(); // will return Result<Value, Route>
+```
+
---
### Release 0.1.6 **\[YANKED\]**