[][src]Enum geo_types::Geometry

pub enum Geometry<T> where
    T: CoordinateType
{ Point(Point<T>), Line(Line<T>), LineString(LineString<T>), Polygon(Polygon<T>), MultiPoint(MultiPoint<T>), MultiLineString(MultiLineString<T>), MultiPolygon(MultiPolygon<T>), GeometryCollection(GeometryCollection<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).

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>)

Methods

impl<T: CoordinateType> Geometry<T>[src]

pub fn into_point(self) -> Option<Point<T>>[src]

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]

If this Geometry is a LineString, then return that LineString, else None.

pub fn into_line(self) -> Option<Line<T>>[src]

If this Geometry is a Line, then return that Line, else None.

pub fn into_polygon(self) -> Option<Polygon<T>>[src]

If this Geometry is a Polygon, then return that, else None.

pub fn into_multi_point(self) -> Option<MultiPoint<T>>[src]

If this Geometry is a MultiPoint, then return that, else None.

pub fn into_multi_line_string(self) -> Option<MultiLineString<T>>[src]

If this Geometry is a MultiLineString, then return that, else None.

pub fn into_multi_polygon(self) -> Option<MultiPolygon<T>>[src]

If this Geometry is a MultiPolygon, then return that, else None.

Trait Implementations

impl<T: PartialEq> PartialEq<Geometry<T>> for Geometry<T> where
    T: CoordinateType
[src]

impl<T: CoordinateType> From<Point<T>> for Geometry<T>[src]

impl<T: CoordinateType> From<Line<T>> for Geometry<T>[src]

impl<T: CoordinateType> From<LineString<T>> for Geometry<T>[src]

impl<T: CoordinateType> From<Polygon<T>> for Geometry<T>[src]

impl<T: CoordinateType> From<MultiPoint<T>> for Geometry<T>[src]

impl<T: CoordinateType> From<MultiLineString<T>> for Geometry<T>[src]

impl<T: CoordinateType> From<MultiPolygon<T>> for Geometry<T>[src]

impl<T: Clone> Clone for Geometry<T> where
    T: CoordinateType
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for Geometry<T> where
    T: CoordinateType
[src]

Auto Trait Implementations

impl<T> Send for Geometry<T> where
    T: Send

impl<T> Sync for Geometry<T> where
    T: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]