Add diffusion coefficient quantities and related units.#322
Merged
iliekturtles merged 1 commit intoAug 9, 2022
Merged
Conversation
Owner
|
Thanks for all these PRs! I'll try to work through them ASAP but it will likely take me some days. |
Contributor
Author
|
Thank you! Please take your time! |
iliekturtles
requested changes
Aug 7, 2022
iliekturtles
left a comment
Owner
There was a problem hiding this comment.
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())));
Owner
|
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
Contributor
Author
|
I think that suggestions in PR will be the easiest option. |
Resolves iliekturtles#321 Co-authored-by: Mike Boutin <mike.boutin@gmail.com>
2a9a0db to
94f1b8c
Compare
Owner
|
Thanks for this PR! I'll be trying to work through the other PRs this week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should resolve #321
I'm not sure completely about singular for "stokes" unit, it seems it's always used in plural form.