Tehforsch / diman

Define rust compile time unit systems using const generics
52 stars 2 forks source link

Allow loading preludes or extending previous `unit_system` calls #43

Open Tehforsch opened 8 months ago

Tehforsch commented 8 months ago

It would be nice to be able to do something like

unit_system!(
    load "si_prelude",
    unit foo = 12 * meters,
)

in order to extend pre-defined systems of units with a few custom units.

Another option could be to allow calling unit_system (or rather a stripped down version of the macro) again in order to add units to the previously generated Quantity type, such as

unit_system!(
    ...
)

add_units!(
    unit foo = 12 * meters,
)

However this requires persistence across multiple macro calls which is non-trivial (see https://github.com/rust-lang/rust/issues/44034)