I'd definitely be interested in helping one of these, I'm currently using your library to implement substitutions over terms for some programming-languages work I'm doing. I'm also looking to get in some PRs for Hacktoberfest.
What would you think of something like this:
impl<C,T,I> Term for C where
C : IntoIter<Item = T, IntoIter =I> + FromIterator<T>,
T : Term,
I : Iterator<Item = T> {...
//Bodies implemented using iter functions
}
This would knock a bunch of collections off the list.
My concern is that we may want to special case Term for some collection and that this blanket implementation would preclude that. We could definitely write a macro_rules for this, and then we would just have a tiny bit of copy-pasting (or we could go even deeper to avoid even this).
Something like:
macro_rules! impl_term_for_collection {(
$(
$collection:ty ;
)*) => {
$(implTermfor $collection {// ...})*}}// And then use it...impl_term_for_collection!{Vec<T>;
HashMap<K, V>
}
(The macro would need to handle type parameters and their bounds too, which my sketch doesn't do.)
See a mostly complete list here:
scrapmetal/src/term_impls.rs
Lines 121 to 418 in b774152
Lots of work to be done here, easy to parallelize across multiple PRs from multiple folks :)
The text was updated successfully, but these errors were encountered: