Skip to content

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