Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a remove() in MultiDict #32

Open
golddranks opened this issue Sep 15, 2016 · 1 comment
Open

Provide a remove() in MultiDict #32

golddranks opened this issue Sep 15, 2016 · 1 comment

Comments

@golddranks
Copy link

golddranks commented Sep 15, 2016

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.

@golddranks
Copy link
Author

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("");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant