Crate shapely_urlencoded

Source
Expand description

§shapely-urlencoded

experimental free of syn crates.io documentation MIT/Apache-2.0 licensed

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:

at your option.

Enums§

UrlEncodedError
Errors that can occur during URL encoded form data deserialization.

Functions§

from_urlencoded
Deserializes URL encoded form data into a Shapely Partial.