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

Method div_op

crates/gitql-core/src/values/integer.rs:78–87  ·  view source on GitHub ↗
(&self, other: &Box<dyn Value>)

Source from the content-addressed store, hash-verified

76 }
77
78 fn div_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
79 if let Some(other_int) = other.as_any().downcast_ref::<IntValue>() {
80 if other_int.value == 0 {
81 return Err("Can't perform `/` operator with 0 value".to_string());
82 }
83 let value = self.value / other_int.value;
84 return Ok(Box::new(IntValue::new(value)));
85 }
86 Err("Unexpected type to perform `/` with".to_string())
87 }
88
89 fn rem_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
90 if let Some(other_int) = other.as_any().downcast_ref::<IntValue>() {

Callers

nothing calls this directly

Calls 1

as_anyMethod · 0.45

Tested by

no test coverage detected