Skip to content

improved scope struct access#161

Open
Wicpar wants to merge 1 commit into
197g:masterfrom
Wicpar:better_scope
Open

improved scope struct access#161
Wicpar wants to merge 1 commit into
197g:masterfrom
Wicpar:better_scope

Conversation

@Wicpar

@Wicpar Wicpar commented Apr 11, 2023

Copy link
Copy Markdown

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.

@197g 197g left a comment

Copy link
Copy Markdown
Owner

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

Wicpar commented Jun 13, 2023

Copy link
Copy Markdown
Author

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