pencil
pencil copied to clipboard
Provide a `remove()` in `MultiDict`
Patterns like this
let email = login_form.remove("email").unwrap_or_else(|| "".into());
can't be used without remove(), i.e. a getter that provides the value as a value, not as a reference.
I think that another way to improve this would be that the return type of request.form() would have &strs instead of Strings, possibly even in a zero-copy way. The user could then clone() if they wanted or needed to.
Btw. a surprisingly tidy workaround for this. But getting rid of the map would be ideal.
let email = login_form.get("email").map(String::as_ref).unwrap_or("");