# plansolve
Official Rust client library for the [PlanSolve](https://getplansolve.com) optimization API.
Solve field service routing, professional services task assignment, and shift
scheduling problems with a simple, async API. Every optimization type follows the
same workflow: construct a request, start the solver, poll for status, get results.
```toml
[dependencies]
plansolve = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
serde_json = "1"
```
```rust
use plansolve::Client;
#[tokio::main]
async fn main() -> plansolve::Result<()> {
let client = Client::from_env()?; // reads PLANSOLVE_API_KEY
let text = std::fs::read_to_string("request.json").unwrap();
let request = serde_json::from_str(&text).unwrap();
let result = client
.field_service
.start_and_wait_for_completion(&request, 5000, 10)
.await?;
println!("score: {:?}", result.score);
Ok(())
}
```
A `plansolve` command-line tool built on this library is available in the
[`plansolve-cli`](https://crates.io/crates/plansolve-cli) crate.
## License
MIT