Skip to content

Commit 701a96c

Browse files
authored
Merge pull request #654 from EnergySystemsModellingLab/unit-type-fixes
A couple of small fixes for unit types
2 parents f6ff308 + 86791a4 commit 701a96c

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/units.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ macro_rules! base_unit_struct {
2727
}
2828
}
2929
impl std::ops::Div<$name> for $name {
30-
type Output = $name;
31-
fn div(self, rhs: $name) -> $name {
32-
$name(self.0 / rhs.0)
30+
type Output = Dimensionless;
31+
fn div(self, rhs: $name) -> Dimensionless {
32+
Dimensionless(self.0 / rhs.0)
3333
}
3434
}
3535
impl std::iter::Sum for $name {
@@ -60,19 +60,19 @@ macro_rules! base_unit_struct {
6060
}
6161
impl $name {
6262
/// Returns the underlying f64 value.
63-
pub fn value(self) -> f64 {
63+
pub fn value(&self) -> f64 {
6464
self.0
6565
}
6666
/// Returns true if the value is a normal number.
67-
pub fn is_normal(self) -> bool {
67+
pub fn is_normal(&self) -> bool {
6868
self.0.is_normal()
6969
}
7070
/// Returns true if the value is finite.
71-
pub fn is_finite(self) -> bool {
71+
pub fn is_finite(&self) -> bool {
7272
self.0.is_finite()
7373
}
7474
/// Returns the absolute value of this unit.
75-
pub fn abs(self) -> Self {
75+
pub fn abs(&self) -> Self {
7676
$name(self.0.abs())
7777
}
7878
}

0 commit comments

Comments
 (0)