diff --git a/demos/ext/rust_magnus_geo/src/lib.rs b/demos/ext/rust_magnus_geo/src/lib.rs index 0a95b46..ee12e07 100644 --- a/demos/ext/rust_magnus_geo/src/lib.rs +++ b/demos/ext/rust_magnus_geo/src/lib.rs @@ -77,11 +77,12 @@ impl Rectangle { } /// Checks if the given `Point` is inside this `Rectangle`. - fn contains(&self, _other: &Point) -> Result { - let _top_left = self.top_left.try_convert::<&Point>()?; - let _bottom_right = self.bottom_right.try_convert::<&Point>()?; + fn contains(&self, other: &Point) -> Result { + let top_left = self.top_left.try_convert::<&Point>()?; + let bottom_right = self.bottom_right.try_convert::<&Point>()?; - Err(Error::new(not_imp_error(), "finish me!")) + Ok(other.x >= top_left.x && other.x <= bottom_right.x && + other.y >= bottom_right.y && other.y <= top_left.y) } }