v0.25.3
Add SystemTarget extractor
-
Adds
SystemTarget<T>extractor that provides access to the full target state passed to the worker, as opposed toTarget<T>which resolves to the value
at the task's scoped path- The global target is now automatically propagated to child tasks in methods, so
.with_target()is no longer needed when forwarding the same target - Adds
target_overridetoContextto distinguish between the global target and an explicit override viawith_target()
Example
SystemTargetis useful when a task scoped to a sub-path needs to inspect the full target state:use mahler::state::{State, Map}; use mahler::extract::{View, Target, SystemTarget}; use mahler::task::IO; #[derive(State)] struct App { services: Map<String, Service>, } #[derive(State)] struct Service { image: String, running: bool, } // This task is scoped to a single service via "/{service}" // `Target` gives the target for this specific service // `SystemTarget` gives the full App target fn start_service( mut svc: View<Service>, Target(tgt): Target<Service>, SystemTarget(app_tgt): SystemTarget<App>, ) { // Use the scoped target for this service svc.running = tgt.running; // Use the system target to check other services, // e.g. to coordinate dependencies across services let total_services = app_tgt.services.len(); // ... }
- The global target is now automatically propagated to child tasks in methods, so
Methods no longer need .with_target() to forward the target to child tasks:
```rust
// Before
fn my_method(Target(tgt): Target<i32>) -> Vec<Task> {
vec![child_task.with_target(tgt)]
}
// After - global target is propagated automatically
fn my_method() -> Vec<Task> {
vec![child_task.into_task()]
}
List of commits
a2f3b8a (Add SystemTarget extractor, 2026-02-18)