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

improved scope struct access #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

@HeroicKatora HeroicKatora 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.

None yet

2 participants