Skip to content

url::form_urlencoded::serialize is moving iterated key-value pairs #81

Closed
@Byron

Description

@Byron

Currently serialize() is difficult to use for all users who don't want to drain vectors of string slices, but prefer keep iteration strictly read only.
Maybe, in the servo project it's uncommon to do that, but at least I am making my case and believe read-only operation should be the default.

Example

url::form_urlencoded::serialize([("client_id", "bogus"),
                                 ("scope", "A B C"].iter().map(|&(a,b)| (a, b)));

To my mind, the .map() call should not be required.

Maybe my code is the exception though, and not the rule, but when implementing protocols one will usually have a pre-determined set of key-value pairs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions