Skip to content

Conversation

@Wicpar
Copy link

@Wicpar Wicpar commented Apr 11, 2023

This improves the scope struct acces, by adding an into_iter and a safe TryFrom<HashMap>;

I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to chose either at their option.

Copy link
Owner

@197g 197g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

into_iter(self) looks quite good, sure.

That said, I'm not sure if TryFrom is the right trait here, necessarily. In that the parameter HashSet<String> is quite specific and that specificity is motivated by implementation details primarily.

On the other hand, why not special case the zero-allocation conversion.

I'd be eager to explore alternatives and hear more arguments either.

@Wicpar
Copy link
Author

Wicpar commented Jun 13, 2023

TryFrom can be implemented for any number of types on any given struct, there will never be any conflict unlike with impl x for T. Even if you wish to change the undelying structure you can always replace the implementation with .into_iter().collect() and implement a second TryFrom for the new underlying structure.

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