MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / add

Method add

crates/gitql-ast/src/interval.rs:21–30  ·  view source on GitHub ↗
(&self, other: &Interval)

Source from the content-addressed store, hash-verified

19
20impl 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();

Callers 1

add_opMethod · 0.80

Calls 2

Tested by

no test coverage detected