-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add diffusion coefficient quantities and related units. #322
Add diffusion coefficient quantities and related units. #322
Conversation
Thanks for all these PRs! I'll try to work through them ASAP but it will likely take me some days. |
Thank you! Please take your time! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've started my review. What's the best way to suggest changes? I've done all three for this PR.
- As suggestions in the PR.
- As a patch in a comment.
- As a branch in my fork. https://github.com/crystal-growth/uom/compare/add_diffusion_coefficient...iliekturtles:uom:add_diffusion_coefficient?expand=1
diff --git a/src/si/diffusion_coefficient.rs b/src/si/diffusion_coefficient.rs
index 37ec6b4..959d4ac 100644
--- a/src/si/diffusion_coefficient.rs
+++ b/src/si/diffusion_coefficient.rs
@@ -13,20 +13,19 @@ quantity! {
Z0, // amount of substance
Z0>; // luminous intensity
units {
- @square_meter_per_second: prefix!(none); "m² · s⁻¹",
- "square meter per second", "square meters per second";
- @square_centimeter_per_second: prefix!(centi) * prefix!(centi); "cm² · s⁻¹",
- "square centimeter per second", "square centimeters per second";
- @square_millimeter_per_second: prefix!(milli) * prefix!(milli); "mm² · s⁻¹",
- "square millimeter per second", "square millimeters per second";
- @square_micrometer_per_second: prefix!(micro) * prefix!(micro); "µm² · s⁻¹",
- "square micrometer per second", "square micrometers per second";
- @square_nanometer_per_second: prefix!(nano) * prefix!(nano); "nm² · s⁻¹",
- "square nanometer per second", "square nanometers per second";
- @stokes: prefix!(centi) * prefix!(centi); "St",
- "stokes", "stokes";
- @centistokes: prefix!(centi) * prefix!(centi) * prefix!(centi); "cSt",
- "stokes", "stokes";
+ @square_meter_per_second: prefix!(none); "m┬▓/s", "square meter per second",
+ "square meters per second";
+ @square_centimeter_per_second: prefix!(centi) * prefix!(centi); "cm┬▓/s",
+ "square centimeter per second", "square centimeters per second";
+ @square_millimeter_per_second: prefix!(milli) * prefix!(milli); "mm┬▓/s",
+ "square millimeter per second", "square millimeters per second";
+ @square_micrometer_per_second: prefix!(micro) * prefix!(micro); "┬╡m┬▓/s",
+ "square micrometer per second", "square micrometers per second";
+ @square_nanometer_per_second: prefix!(nano) * prefix!(nano); "nm┬▓/s",
+ "square nanometer per second", "square nanometers per second";
+ @stokes: prefix!(centi) * prefix!(centi); "St", "Stokes", "Stokes";
+ @centistokes: prefix!(centi) * prefix!(centi) * prefix!(centi); "cSt", "centistokes",
+ "centistokes";
}
}
@@ -35,7 +34,7 @@ mod test {
storage_types! {
use crate::num::One;
use crate::si::quantities::*;
- use crate::si::time as t;
+ use crate::si::time as t;
use crate::si::area as area;
use crate::si::diffusion_coefficient as dc;
@@ -49,15 +48,15 @@ mod test {
#[test]
fn check_units() {
- test::<t::second, area::square_meter, dc::square_meter_per_second>();
- test::<t::second, area::square_centimeter, dc::square_centimeter_per_second>();
- test::<t::second, area::square_millimeter, dc::square_millimeter_per_second>();
- test::<t::second, area::square_micrometer, dc::square_micrometer_per_second>();
- test::<t::second, area::square_nanometer, dc::square_nanometer_per_second>();
- test::<t::second, area::square_centimeter, dc::stokes>();
- test::<t::second, area::square_millimeter, dc::centistokes>();
+ test::<area::square_meter, t::second, dc::square_meter_per_second>();
+ test::<area::square_centimeter, t::second, dc::square_centimeter_per_second>();
+ test::<area::square_millimeter, t::second, dc::square_millimeter_per_second>();
+ test::<area::square_micrometer, t::second, dc::square_micrometer_per_second>();
+ test::<area::square_nanometer, t::second, dc::square_nanometer_per_second>();
+ test::<area::square_centimeter, t::second, dc::stokes>();
+ test::<area::square_millimeter, t::second, dc::centistokes>();
- fn test< T: t::Conversion<V>, A: area::Conversion<V>, DC: dc::Conversion<V>>() {
+ fn test<A: area::Conversion<V>, T: t::Conversion<V>, DC: dc::Conversion<V>>() {
Test::assert_approx_eq(&DiffusionCoefficient::new::<DC>(V::one()),
&(Area::new::<A>(V::one())
/ Time::new::<T>(V::one())));
One more thing to add is that if you rebase on top of the latest master the 1.43.0 tests will stop failing. |
1cf6d33
to
2a9a0db
Compare
I think that suggestions in PR will be the easiest option. |
Resolves iliekturtles#321 Co-authored-by: Mike Boutin <[email protected]>
2a9a0db
to
94f1b8c
Compare
Thanks for this PR! I'll be trying to work through the other PRs this week. |
Should resolve #321
I'm not sure completely about singular for "stokes" unit, it seems it's always used in plural form.