notbad4u / query_params Goto Github PK
View Code? Open in Web Editor NEWCustom derive to automatically implement serialization to http query params for arbitrary structs.
License: MIT License
Custom derive to automatically implement serialization to http query params for arbitrary structs.
License: MIT License
Hi,
It's just idea.
There is a quite good url lib that could match your library.
There is a set_query method that near match your to_query_params()
.
Your generate ?sth=2
url
accept Some("sth=2")
(without ?
). I think it would be nice to make your solution merged. Serialize structures with derive
is nice future.
Problem occurs when your struct contains only Option
and you can generate empty str.
let generated_query = structure.to_query_params();
if generated_query.len() > 0 {
url.set_query(Some(&generated_query.as_str()[1..]));
}
I will link to this issue from url. Maybe sb will be interested and find a nice solution.
This doesn't handle values containing special characters correctly, because it doesn't escape them. This is particularly problematic for &
and =
, since these will now be interpreted as separate parameters. This could lead to security vulnerabilities, similar to SQL-Injection or XSS.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.