Skip to content

meilisearch/yaup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Yaup - Yet Another URL Params crate

This is a fork of serde_url_params. I updated the way of serializing arrays: Serializing { "food": ["baguette", "with", "cheese"] }

  • With serde_url_params returns food=baguette&food=with&food=cheese.
  • With yaup it returns food=baguette,with,cheese.

And I got rids of the serialization of embedded structures.

Example

#[derive(Debug, Serialize)]
enum Filter { New, Registered, Blocked }

#[derive(Debug, Serialize)]
struct Params {
    cursor: Option<usize>,
    per_page: Option<usize>,
    username: String,
    filter: Vec<Filter>,
}

let params = Params {
    cursor: Some(42),
    per_page: None,
    username: String::from("tamo"),
    filter: vec![Filter::New, Filter::Blocked],
};
assert_eq!(
    yaup::to_string(&params).unwrap(),
    "cursor=42&username=boxdot&filter=New,Blocked"
);

License

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this document by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

URL parameters serialization

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 97.4%
  • Shell 2.6%