aboutsummaryrefslogtreecommitdiffstats
path: root/src/volume/cubic_centimetre.rs
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2023-01-20 20:04:28 -0330
committerSam Anthony <sam@samanthony.xyz>2023-01-20 20:04:28 -0330
commit3a1e9d081cc299a0ce3e950282464986a36376d9 (patch)
tree1f01505157643ad9b42fd0fc3006126d6e524838 /src/volume/cubic_centimetre.rs
parent413608ea229f0adec21feb27501178ccadd47844 (diff)
downloadvolute-3a1e9d081cc299a0ce3e950282464986a36376d9.zip
refactor volume module
Diffstat (limited to 'src/volume/cubic_centimetre.rs')
-rw-r--r--src/volume/cubic_centimetre.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/volume/cubic_centimetre.rs b/src/volume/cubic_centimetre.rs
new file mode 100644
index 0000000..760a3f3
--- /dev/null
+++ b/src/volume/cubic_centimetre.rs
@@ -0,0 +1,16 @@
+use super::{CubicMetre, Litre};
+
+#[derive(Debug, PartialEq)]
+pub struct CubicCentimetre(pub f64);
+
+impl From<CubicMetre> for CubicCentimetre {
+ fn from(value: CubicMetre) -> Self {
+ Self(value.0 * 10_f64.powi(6))
+ }
+}
+
+impl From<Litre> for CubicCentimetre {
+ fn from(value: Litre) -> Self {
+ Self(value.0 * 10_f64.powi(3))
+ }
+}