Skip to content

feat: Add one Grammatical sugar #581

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

Closed
wants to merge 1 commit into from
Closed

feat: Add one Grammatical sugar #581

wants to merge 1 commit into from

Conversation

tu6ge
Copy link

@tu6ge tu6ge commented Dec 7, 2022

Examples:

use http::HeaderMap;

fn hello<M: Into<HeaderMap>>(map: M){
    let map: HeaderMap = map.into();
    // more ...
}

// before call it with zero item
use http::HeaderMap;
hello(HeaderMap::new());
// now call it with zero item
hello([]);

@seanmonstar
Copy link
Member

Thanks for the PR! However, I don't think having this sugar in the library is what we want. There is the existing FromIterator implementation that helps with this.

@seanmonstar seanmonstar closed this Dec 7, 2022
@tu6ge
Copy link
Author

tu6ge commented Dec 8, 2022

It suddenly dawned on me, FromIterator is a more abstract From type. Wonderful rust !

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

Successfully merging this pull request may close these issues.

2 participants