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 a struct to be annotated with a
ListBuild
derive. Essentially, all it does is create ahl_new
function for the struct it's annotating.hl_new
constructs the type bypluck
ing a value from the passed-in list for each field in the struct, returning the new struct, and the post-plucked list.The motivation is for it to be used in esp32-hal crate. Currently, managing pins is done with a struct. These pins are zero-sized, const-generic separated types. In order to build a peripheral, you need to be careful partial moves. This is not feasable:
This PR allows for code like this:
...this makes helpers, constructors, etc. an option, opening the posibility for much more idiomatic organisation of code.
It also allows for correctness of managing resources to be easily encapsulated at the type-level. The global set of resources (pins, clocks, etc.) could be encapsulated as a type, and all resources get rolled-up into a single HList. You cannot pluck the same type from this HList more than once. You always have on hand a list of available resources.
Future work:
into_push_pull_output(fielda: SomeType)
onfielda
: