Enum geo_types::Geometry [−][src]
pub enum Geometry<T> where
T: CoordNum, { Point(Point<T>), Line(Line<T>), LineString(LineString<T>), Polygon(Polygon<T>), MultiPoint(MultiPoint<T>), MultiLineString(MultiLineString<T>), MultiPolygon(MultiPolygon<T>), GeometryCollection(GeometryCollection<T>), Rect(Rect<T>), Triangle(Triangle<T>), }
An enum representing any possible geometry type.
All Geo types can be converted to a Geometry member using .into() (as part of the
std::convert::Into pattern), and Geo types implement the TryFrom trait in order to
convert back from enum members.
Example
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe: Geometry<f64> = p.into(); let pn = Point::try_from(pe).unwrap();
Variants
Point(Point<T>)Line(Line<T>)LineString(LineString<T>)Polygon(Polygon<T>)MultiPoint(MultiPoint<T>)MultiLineString(MultiLineString<T>)MultiPolygon(MultiPolygon<T>)GeometryCollection(GeometryCollection<T>)Rect(Rect<T>)Triangle(Triangle<T>)Implementations
impl<T: CoordNum> Geometry<T>[src]
pub fn into_point(self) -> Option<Point<T>>[src]
Will be removed in an upcoming version. Switch to std::convert::TryInto<Point>
If this Geometry is a Point, then return that, else None.
Examples
use geo_types::*; let g = Geometry::Point(Point::new(0., 0.)); let p2: Point<f32> = g.into_point().unwrap(); assert_eq!(p2, Point::new(0., 0.,));
pub fn into_line_string(self) -> Option<LineString<T>>[src]
Will be removed in an upcoming version. Switch to std::convert::TryInto<LineString>
If this Geometry is a LineString, then return that LineString, else None.
pub fn into_line(self) -> Option<Line<T>>[src]
Will be removed in an upcoming version. Switch to std::convert::TryInto<Line>
If this Geometry is a Line, then return that Line, else None.
pub fn into_polygon(self) -> Option<Polygon<T>>[src]
Will be removed in an upcoming version. Switch to std::convert::TryInto<Polygon>
If this Geometry is a Polygon, then return that, else None.
pub fn into_multi_point(self) -> Option<MultiPoint<T>>[src]
Will be removed in an upcoming version. Switch to std::convert::TryInto<MultiPoint>
If this Geometry is a MultiPoint, then return that, else None.
pub fn into_multi_line_string(self) -> Option<MultiLineString<T>>[src]
Will be removed in an upcoming version. Switch to std::convert::TryInto<MultiLineString>
If this Geometry is a MultiLineString, then return that, else None.
pub fn into_multi_polygon(self) -> Option<MultiPolygon<T>>[src]
Will be removed in an upcoming version. Switch to std::convert::TryInto<MultiPolygon>
If this Geometry is a MultiPolygon, then return that, else None.
Trait Implementations
impl<T: Clone> Clone for Geometry<T> where
T: CoordNum, [src]
T: CoordNum,
impl<T: Debug> Debug for Geometry<T> where
T: CoordNum, [src]
T: CoordNum,
impl<T: Eq> Eq for Geometry<T> where
T: CoordNum, [src]
T: CoordNum,
impl<T: CoordNum> From<Line<T>> for Geometry<T>[src]
impl<T: CoordNum> From<LineString<T>> for Geometry<T>[src]
fn from(x: LineString<T>) -> Geometry<T>[src]
impl<T: CoordNum> From<MultiLineString<T>> for Geometry<T>[src]
fn from(x: MultiLineString<T>) -> Geometry<T>[src]
impl<T: CoordNum> From<MultiPoint<T>> for Geometry<T>[src]
fn from(x: MultiPoint<T>) -> Geometry<T>[src]
impl<T: CoordNum> From<MultiPolygon<T>> for Geometry<T>[src]
fn from(x: MultiPolygon<T>) -> Geometry<T>[src]
impl<T: CoordNum> From<Point<T>> for Geometry<T>[src]
impl<T: CoordNum> From<Polygon<T>> for Geometry<T>[src]
impl<T: CoordNum> From<Rect<T>> for Geometry<T>[src]
impl<T: CoordNum> From<Triangle<T>> for Geometry<T>[src]
impl<T: Hash> Hash for Geometry<T> where
T: CoordNum, [src]
T: CoordNum,
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<T: PartialEq> PartialEq<Geometry<T>> for Geometry<T> where
T: CoordNum, [src]
T: CoordNum,
impl<T> StructuralEq for Geometry<T> where
T: CoordNum, [src]
T: CoordNum,
impl<T> StructuralPartialEq for Geometry<T> where
T: CoordNum, [src]
T: CoordNum,
impl<T: CoordNum> TryFrom<Geometry<T>> for Point<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for Line<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for LineString<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for Polygon<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for MultiPoint<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for MultiLineString<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for MultiPolygon<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for Rect<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
type Error = Error
The type returned in the event of a conversion error.
fn try_from(geom: Geometry<T>) -> Result<Self, Self::Error>[src]
impl<T: CoordNum> TryFrom<Geometry<T>> for Triangle<T>[src]
Convert a Geometry enum into its inner type.
Fails if the enum case does not match the type you are trying to convert it to.
Auto Trait Implementations
impl<T> RefUnwindSafe for Geometry<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Geometry<T> where
T: Send,
T: Send,
impl<T> Sync for Geometry<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Geometry<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Geometry<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,