-
Notifications
You must be signed in to change notification settings - Fork 9
Separate Ident Types for Different Specificities #530
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
Conversation
7463218 to
fc985e8
Compare
|
This is all ready for review now, apologies for the larger commits, I wanted to have the tests passing on each on in case of rebasing |
Codecov Report
@@ Coverage Diff @@
## master #530 +/- ##
==========================================
- Coverage 58.96% 58.90% -0.07%
==========================================
Files 207 213 +6
Lines 14696 14910 +214
==========================================
+ Hits 8666 8783 +117
- Misses 6030 6127 +97
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
6cf13cd to
ddc22f9
Compare
db5bceb to
3043738
Compare
3043738 to
97e8c9a
Compare
|
@jrray this PR underpins pretty much everything that I have going and I'd like to get it in soon, if possible. Before we reach anything that diverges the code base too much... |
The pattern is <base>/<target> which allows for defining different spcificity levels as well as nice composition of different ident types. This initial commit defines different ident types as well as an AnyIdent with an optional build that replaces the old ident nearly everywhere. Next steps are to use more specific identifier types where applicable Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
This mean that the v0 spec type needed to be updated to be generic over the internal ident type, as well as the storage interfaces using the appropriate ident types for loading recipes vs packages. This was largely an exercise in refactoring and separating logic that used to be conditional on the presence of a build into distict functions instead. Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits!
Uses macros to share common 'inheritance' instead of having a deref implementation. This works better accross types where dereferencing to the base is not as useful as the target (eg located idents) but also creates a safer usage where ident types are not converted silently, instead needing an explicit conversion call by the developer. Additionally, add a HasLocation trait to complete the set. Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
741933c to
f4ee76d
Compare
Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
|
Apparently, there are some new clippy lints in 1.66 - I've fixed those now, as well |
Building on top of #529, this changeset updates the
Identtype to be a generic type so that we can define different versions of it for the recipe/version-only vs package/build identifiers. The general semantics is that each identifier is composed of two types (Base/Target). The main benefit of this is that it can dereference to theBasetype, meaning that theBuildIdentcan also be used as a reference to aVersionIdent(it's base).Along with
VersionIdent = Ident<PkgNameBuf, Version>andBuildIdent = Ident<VersionIdent, Build>there is anAnyIdent = Ident<VersionIdent, Option<Build>which I used to replace everything in this first refactoring pass, but aim to replace where appropriate before this MR is ready.I've also introduced the
HasVersion,HasBuild, andHasLocationtraits in order to have useful bounds for functions that take more than one flavor of ident.TODO:
HasLocationimplemented byLocatedBuildIdentandLocatedVersionIdentas_andto_conversions for sanity checking in implementations