Make Entry type public #8
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows external code to express constraints like
N: ArrayLength<Entry<T>>, which is not possible with the enum hidden in a module.Entry is made into a struct that contains a single enum; this appears to be the common pattern while enums can not yet be opaque types.
#1 was flawed in that it did change one piece of external API (which I just had not used yet): the type constraint needed to get a suitable N. Consequently, external code that previously would have used constraints like
N: ArrayLength<Option<IT>> + ArrayLength<usize>could now not express this requirement any more at all.This does not fix the API breakage introduced by this, but hides it now and in future behind an
Entrystruct (which appears to be the common way to wrap an Enum to not be publicly visible but still allocatable these days), which future changes are free to modify. Applications can now useN: ArrayLength<Entry<IT>>as criterion for an N to be suitable.