diff --git a/geo-types/src/geometry.rs b/geo-types/src/geometry.rs index b7f74ac50..251ee38bc 100644 --- a/geo-types/src/geometry.rs +++ b/geo-types/src/geometry.rs @@ -61,10 +61,10 @@ impl Geometry { /// ``` /// use geo_types::*; /// let g = Geometry::Point(Point::new(0., 0.)); - /// let p2: Point = g.as_point().unwrap(); + /// let p2: Point = g.into_point().unwrap(); /// assert_eq!(p2, Point::new(0., 0.,)); /// ``` - pub fn as_point(self) -> Option> { + pub fn into_point(self) -> Option> { if let Geometry::Point(x) = self { Some(x) } else { @@ -73,7 +73,7 @@ impl Geometry { } /// If this Geometry is a LineString, then return that LineString, else None. - pub fn as_linestring(self) -> Option> { + pub fn into_line_string(self) -> Option> { if let Geometry::LineString(x) = self { Some(x) } else { @@ -82,7 +82,7 @@ impl Geometry { } /// If this Geometry is a Line, then return that Line, else None. - pub fn as_line(self) -> Option> { + pub fn into_line(self) -> Option> { if let Geometry::Line(x) = self { Some(x) } else { @@ -91,7 +91,7 @@ impl Geometry { } /// If this Geometry is a Polygon, then return that, else None. - pub fn as_polygon(self) -> Option> { + pub fn into_polygon(self) -> Option> { if let Geometry::Polygon(x) = self { Some(x) } else { @@ -100,7 +100,7 @@ impl Geometry { } /// If this Geometry is a MultiPoint, then return that, else None. - pub fn as_multipoint(self) -> Option> { + pub fn into_multi_point(self) -> Option> { if let Geometry::MultiPoint(x) = self { Some(x) } else { @@ -109,7 +109,7 @@ impl Geometry { } /// If this Geometry is a MultiLineString, then return that, else None. - pub fn as_multilinestring(self) -> Option> { + pub fn into_multi_line_string(self) -> Option> { if let Geometry::MultiLineString(x) = self { Some(x) } else { @@ -118,7 +118,7 @@ impl Geometry { } /// If this Geometry is a MultiPolygon, then return that, else None. - pub fn as_multipolygon(self) -> Option> { + pub fn into_multi_polygon(self) -> Option> { if let Geometry::MultiPolygon(x) = self { Some(x) } else { diff --git a/geo-types/src/lib.rs b/geo-types/src/lib.rs index 89350ee55..d760becb5 100644 --- a/geo-types/src/lib.rs +++ b/geo-types/src/lib.rs @@ -84,7 +84,7 @@ mod test { let p: Point = Point::new(0., 0.); let p1 = p.clone(); let g: Geometry = p.into(); - let p2 = g.as_point().unwrap(); + let p2 = g.into_point().unwrap(); assert_eq!(p1, p2); }