Conversation
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
| /// | ||
| /// We need to do this in this manner because of rust needs to keep forward compatibility. | ||
| /// See [this](https://github.com/rust-lang/rust/issues/87479) GitHub issue for more information. | ||
| pub trait MatcherType<Over: ?Sized> { |
There was a problem hiding this comment.
nit - can we keep generic bounds as acronyms/obviously not words, I personally find it confusing but also I've never really seen a rust codebase do that
There was a problem hiding this comment.
Should it just be T?
gatesn
left a comment
There was a problem hiding this comment.
What is MatcherType?
(Want to block until we can chat about this)
Merging this PR will improve performance by 43.1%
Performance Changes
Comparing Footnotes
|
|
|
gatesn
left a comment
There was a problem hiding this comment.
I'm not sure this is any better than separate matcher traits tbh 🤷
Summary
This PR pakes the
Matcherpattern we have been using generic, and replaces the existing duplicated traits. The changes can be roughly seen in this order by the 2 commits.We want this because we will be adding matchers for the extension scalars and arrays in the future, and having 4 duplicated traits that are exactly the same except for 1 parameter is a bit much.
The old trait(s) was this before:
The new trait(s) is now:
Why 2 traits?
Note that the issue in rust-lang/rust#87479 is the reason we need to split this out into 2 traits. This meant changing some fully qualified paths, but that is just a cosmetic change.
Why generic
MatcherType<Over: ?Sized>?Also, you might wonder why the
MatcherTypealso has a generic parameter. This is because we have both aimpl<V: VTable> MatcherType<dyn Array> for Vand aimpl<V: ExtVTable> MatcherType<ExtDTypeRef> for V, and without that generic parameter the trait solver cannot distinguish thatVTableis mutually exclusive fromExtVTable.Unresolved Questions
It might be good to also type alias the
Matcher<dyn Array>to anArrayMatcher? Not sure if that's any better.API Changes
Technically there are API changes here but it is mostly related to extension types which nobody should be using right now anyways.
Testing
Since this is a generics change there is not logical difference.