-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Using const generics to express quantities info #381
Comments
I've also tested similar approach writing a toy library inspired by uom (dimensional_quantity) and found it quite convenient. |
The intention is to transition to const generics with a 2.0 or 3.0 release. The current design and using typenum will eventually be stabilized as 1.0. See some past discussion #134 (comment). |
Would it make more sense to work in parallel on another crate that can leverage Const generics and generic associated types? |
I will accept changes into a separate branch that could be merged once it has feature parity and isn't using nightly-only features. And of course anyone can work in a separate crate. |
I am currently working on such a library. I will open a PR once i make my initial release |
I was thinking along the same lines do you have a public repository to accept contributions? |
Hi. I have uploaded just now. I have been quite busy lately and i just cant get over how to implement the auto-unit-part. anyways this is the link: https://github.com/haennes/const_uom I am ready accept contributions by anyone and on any topic. :) |
I've been working on a similar crate for some time now and I've been using it in "production" for a couple of months by now and been pretty happy with the results. In case anybody is curious: https://crates.io/crates/diman |
Finally uploaded an initial version of my REFACTORED code. here https://github.com/haennes/const_units Sorry for teasing this such a long time ago. |
Just Updated it. The Units now are able to be generated. Still awaiting the somewhat stabilization of const trait-impls to advance further. const_ops and const_traits are already implemented and constified. however Ratios, which internally require num-traits to be constified, still need to be constified. I will happily accept contributions :) |
Hello, It would be cool if someone could take a look at this and state their opinion about this. I am especially interested about your thoughts on:
edit: trait StorageDT {}
//T is the QName enum for the System
enum Quantity<T> {
Simple(T),
Complex(Vec<T>),
}
struct Unit<DT: StorageDT, SYSTEM, const QUANTITY: Quantity<SYSTEM>>(DT); Sadly this isn't implemented at this point... |
Sorry for the extended delay! I've had a tab with this issue open for the last three months. I'm not going to have time to review and answer your questions in the foreseeable future. I'm going to prioritize open PRs at the moment but will leave the issue open for when I do have time to get to it. |
Hi, If I at some Point - in the distant future 😂 get the feeling, that the fork is mature enough I will open a PR. Thanks for your answer, leaving this tab open for three months suggests to me that there is an interest in this issue :) |
I'm investigating similar ideas like uom and looking at uom's implementation. But I think maybe use unstable feature const generics will make it much simpler.
here is the playground link for this code. https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=9c4510c55df9fec6593c878d46321220
It's just a suggestion, will the uom adopt this similar approach in the future?
The text was updated successfully, but these errors were encountered: