Skip to content

Conversation

@chrysn
Copy link
Contributor

@chrysn chrysn commented Apr 28, 2020

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 Entry struct (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 use N: ArrayLength<Entry<IT>> as criterion for an N to be suitable.

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.
@codecov-io
Copy link

Codecov Report

Merging #8 into master will increase coverage by 1.17%.
The diff coverage is 14.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #8      +/-   ##
==========================================
+ Coverage   62.57%   63.75%   +1.17%     
==========================================
  Files           2        2              
  Lines         163      160       -3     
  Branches       26       26              
==========================================
  Hits          102      102              
+ Misses         25       22       -3     
  Partials       36       36              
Flag Coverage Δ
#unittests 63.75% <14.28%> (+1.17%) ⬆️
Impacted Files Coverage Δ
src/lib.rs 57.95% <14.28%> (+1.91%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e955ee4...b56e60b. Read the comment docs.

@bugadani bugadani merged commit ac37a2b into bugadani:master Apr 28, 2020
@chrysn chrysn deleted the pub-entry branch April 28, 2020 14:59
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.

3 participants