| Crates.io | urlquerystring |
| lib.rs | urlquerystring |
| version | 0.1.1 |
| created_at | 2025-03-27 14:46:57.424493+00 |
| updated_at | 2025-03-27 16:24:11.299219+00 |
| description | A high-performance, zero-allocation URL query string parser. |
| homepage | https://github.com/deanchalk/urlquerystring |
| repository | https://github.com/deanchalk/urlquerystring |
| max_upload_size | |
| id | 1608026 |
| size | 25,668 |
A high-performance, zero-allocation URL query string parser for Rust. This crate provides a stack-based implementation that extracts query parameters without any heap allocations, making it ideal for performance-critical environments.
use urlquerystring::StackQueryParams;
let url = "https://example.com/path?name=John&age=25&city=New%20York";
let params = StackQueryParams::new(url);
assert_eq!(params.get("name"), Some("John"));
assert_eq!(params.get("city"), Some("New York")); // Automatically percent-decoded
This crate is designed for maximum performance:
use urlquerystring::StackQueryParams;
let url = "https://example.com/path?name=John&age=25";
let params = StackQueryParams::new(url);
// Access parameters
assert_eq!(params.get("name"), Some("John"));
assert_eq!(params.get("age"), Some("25"));
use urlquerystring::StackQueryParams;
// Create a container with custom size limits
let params = StackQueryParams::<32, 64, 256>::custom_new(
"https://example.com/path?param=value"
);
use urlquerystring::StackQueryParams;
let params = StackQueryParams::new("https://example.com/path?a=1&b=2");
for (key, value) in params.iter() {
println!("{} = {}", key, value);
}
The crate provides default size limits that can be used with the new() constructor:
These limits can be customized using the custom_new() constructor with const generics.
This crate is particularly useful in:
If you need more flexibility or don't require zero-allocation parsing:
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.