4 stable releases
Uses new Rust 2024
new 3.1.0 | Mar 31, 2025 |
---|---|
3.0.0 | Mar 11, 2025 |
2.0.1 | Mar 11, 2025 |
#1170 in Parser implementations
434 downloads per month
20KB
178 lines
shapely-urlencoded
A serialization and deserialization library for URL encoded form data using the shapely runtime reflection system.
Features
- Simple URL encoded form data deserialization for any type implementing the
Shapely
trait - Support for query string parsing
- Detailed error reporting with context
- Support for nested structs and scalar values
Example
use shapely::Shapely;
use shapely_urlencoded::from_urlencoded;
#[derive(Debug, Shapely, PartialEq)]
struct SearchParams {
query: String,
page: u64,
}
let query_string = "query=rust+programming&page=2";
let mut partial = SearchParams::partial();
from_urlencoded(&mut partial, query_string).expect("Failed to parse URL encoded data");
let params = partial.build::<SearchParams>();
assert_eq!(params, SearchParams { query: "rust programming".to_string(), page: 2 });
Funding
Thanks to Namespace for providing fast GitHub Actions workers:
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~420KB