midly icon indicating copy to clipboard operation
midly copied to clipboard

Consider using the bounded_integer crate

Open schneiderfelipe opened this issue 10 months ago • 1 comments

Hi @kovaxis! This is more of a suggestion than anything else: maybe there is interest in reducing the technical debt of maintaining u7, u4, etc. and use some purpose-built solution? I've checked the available crates and bounded_integer seemed interesting and used enough to be considered?

cc. @gbrochar you've currently involved in something related in #26 and #27, aren't you?

schneiderfelipe avatar Apr 01 '24 00:04 schneiderfelipe

Hey, I can only agree, I had thought of that but didn't look for existing solutions. I'm done to do more research and code if we find a solution that sounds reasonable. I'm starting my first big project in rust and I would love to contribute for real in a closely related open source project.

I don't want to "bias" the library towards my needs tho and I don't know if I can avoid doing that without exterior opinion.

gbrochar avatar Apr 01 '24 06:04 gbrochar

To be honest, the usage of u4 and u7 in this library is probably a mistake. Sure, it makes the library somewhat more type-safe, but at a the cost of usability. bounded_integer would help, but I'd also prefer not to bring in extra dependencies for the sake of compile times.

For the next breaking change, I will drop the usage of these types and just use u8 and produce an error for out-of-bounds integers. Along with other simplifications to the API.

kovaxis avatar Jun 08 '24 17:06 kovaxis