Open VorpalBlade opened 1 month ago
In case you need to reproduce this: https://github.com/VorpalBlade/paketkoll/tree/feature/konfigkoll (commit 588104d5), in the file crates/konfigkoll_script/src/plugins/passwd.rs
, the function add_from_sysusers
.
Notes:
[patch]
as I want to publish to crates.io)It's not explicitly spelled out in the documentation, but the Function
trait is only implemented up to five parameters.
It's a bit of a pain adding more, since they have to be a permutation between three different traits.
The background for why this is needed is here. Previously the references used were unbound and this pattern is currently needed to unbind them.
However, if we can live with only one trait being implemented for the auxiliary parameters (like FromValue
), that might work too!
Hm, confusingly when I looked at InstanceFunction
it was implemented for way more parameters.
Since you already use a macro (declarative) to generate these impls, what is the cost of repeating it for a few more parameters? Is it build time due to combinatorial explosion?
In that case only supporting Value for parameter 7 up to N makes sense as a compromise.
If you want to play around with the problem space, here's a playground I put together.
This is another playground showing how we currently solve it with references.
Since you already use a macro (declarative) to generate these impls, what is the cost of repeating it for a few more parameters? Is it build time due to combinatorial explosion?
I don't remember. Please try it out if you have the time!
This compiles:
Uncommenting the package parameter gives the following (cryptic) error though:
In fact, commenting out any of the 6 parameters make it work. I cannot find any mention of a 6 parameter limit in the docs?