Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Vlad-Shcherbina
Copy link
Contributor

This is a breaking change to public interface (Reference::generics,
Reference::generics_mut), but I think it's justified
(returning HashMap there was misleading).

@Vlad-Shcherbina
Copy link
Contributor Author

Please note that I avoided touching some helper functions (inner(), is_valid_map_key(), resolve_generics()).
So they still take HashMap and it's somewhat awkward.
If you prefer, I can change them to do a linear scan over a vec instead.

@oscartbeaumont
Copy link
Member

I think that would be a good idea. I would suspect in most cases the number of generics would be low so the vector operations would probably faster or as fast as the map operations.

Thanks for this PR! I am happy to merge it but will wait if you want to push those extra fixes!

@Vlad-Shcherbina
Copy link
Contributor Author

Yeah, I kept thinking about it after I opened the PR and also concluded that switching those helpers is clearly the right thing to do.

Don't merge yet, I'll make the change.

This is a breaking change to public interface (Reference::generics,
Reference::generics_mut), but I think it's justified
(returning HashMap there was misleading).
…shMap

This means a lookup will now require a linear scan, but it should be
fine because we don't expect too many generic args.
@Vlad-Shcherbina
Copy link
Contributor Author

Done!

@oscartbeaumont oscartbeaumont merged commit effe988 into specta-rs:main Oct 30, 2025
4 checks passed
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