(&self, other: &Interval)
| 19 | |
| 20 | impl Interval { |
| 21 | pub fn add(&self, other: &Interval) -> Result<Interval, String> { |
| 22 | let mut result = self.clone(); |
| 23 | result.years = interval_value_or_error_i64(result.years + other.years)?; |
| 24 | result.months = interval_value_or_error_i64(result.months + other.months)?; |
| 25 | result.days = interval_value_or_error_i64(result.days + other.days)?; |
| 26 | result.hours = interval_value_or_error_i64(result.hours + other.hours)?; |
| 27 | result.minutes = interval_value_or_error_i64(result.minutes + other.minutes)?; |
| 28 | result.seconds = interval_value_or_error_f64(result.seconds + other.seconds)?; |
| 29 | Ok(result) |
| 30 | } |
| 31 | |
| 32 | pub fn sub(&self, other: &Interval) -> Result<Interval, String> { |
| 33 | let mut result = self.clone(); |
no test coverage detected