logo
pub fn to_string<T: Serialize>(input: T) -> Result<String, Error>
Expand description

Serializes a value into a application/x-www-form-urlencoded String buffer.

let meal = &[("bread", "baguette"), ("cheese", "comté"), ("meat", "ham"), ("fat", "butter")];

assert_eq!(
    ruma_common::serde::urlencoded::to_string(meal),
    Ok("bread=baguette&cheese=comt%C3%A9&meat=ham&fat=butter".to_owned())
);