[−][src]Struct geo_types::GeometryCollection
A collection of Geometry
types.
It can be created from a Vec
of Geometries, or from an Iterator which yields Geometries.
Looping over this object yields its component Geometry
enum members (not the underlying geometry
primitives), and it supports iteration and indexing as
well as the various
MapCoords
functions, which are directly applied to the
underlying geometry primitives.
Examples
Looping
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let gc = GeometryCollection(vec![pe]); for geom in gc { println!("{:?}", Point::try_from(geom).unwrap().x()); }
Implements iter()
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let gc = GeometryCollection(vec![pe]); gc.iter().for_each(|geom| println!("{:?}", geom));
Mutable Iteration
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let mut gc = GeometryCollection(vec![pe]); gc.iter_mut().for_each(|geom| { if let Geometry::Point(p) = geom { p.set_x(0.2); } }); let updated = gc[0].clone(); assert_eq!(Point::try_from(updated).unwrap().x(), 0.2);
Indexing
use std::convert::TryFrom; use geo_types::{Point, point, Geometry, GeometryCollection}; let p = point!(x: 1.0, y: 1.0); let pe = Geometry::Point(p); let gc = GeometryCollection(vec![pe]); println!("{:?}", gc[0]);
Implementations
impl<T: CoordNum> GeometryCollection<T>
[src]
pub fn new() -> GeometryCollection<T>
[src]
Return an empty GeometryCollection
pub fn len(&self) -> usize
[src]
Number of geometries in this GeometryCollection
pub fn is_empty(&self) -> bool
[src]
Is this GeometryCollection empty
impl<'a, T: CoordNum> GeometryCollection<T>
[src]
pub fn iter(&'a self) -> IterHelper<'a, T>
[src]
pub fn iter_mut(&'a mut self) -> IterMutHelper<'a, T>
[src]
Trait Implementations
impl<T: Clone> Clone for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
pub fn clone(&self) -> GeometryCollection<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
impl<T: CoordNum> Default for GeometryCollection<T>
[src]
impl<T: Eq> Eq for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
impl<T: CoordNum, IG: Into<Geometry<T>>> From<IG> for GeometryCollection<T>
[src]
Convert any Geometry (or anything that can be converted to a Geometry) into a GeometryCollection
impl<T: CoordNum, IG: Into<Geometry<T>>> FromIterator<IG> for GeometryCollection<T>
[src]
Collect Geometries (or what can be converted to a Geometry) into a GeometryCollection
pub fn from_iter<I: IntoIterator<Item = IG>>(iter: I) -> Self
[src]
impl<T: Hash> Hash for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
pub 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: CoordNum> Index<usize> for GeometryCollection<T>
[src]
type Output = Geometry<T>
The returned type after indexing.
pub fn index(&self, index: usize) -> &Geometry<T>
[src]
impl<T: CoordNum> IndexMut<usize> for GeometryCollection<T>
[src]
impl<T: CoordNum> IntoIterator for GeometryCollection<T>
[src]
type Item = Geometry<T>
The type of the elements being iterated over.
type IntoIter = IntoIteratorHelper<T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T: CoordNum> IntoIterator for &'a GeometryCollection<T>
[src]
type Item = &'a Geometry<T>
The type of the elements being iterated over.
type IntoIter = IterHelper<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T: CoordNum> IntoIterator for &'a mut GeometryCollection<T>
[src]
type Item = &'a mut Geometry<T>
The type of the elements being iterated over.
type IntoIter = IterMutHelper<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<T: PartialEq> PartialEq<GeometryCollection<T>> for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
pub fn eq(&self, other: &GeometryCollection<T>) -> bool
[src]
pub fn ne(&self, other: &GeometryCollection<T>) -> bool
[src]
impl<T> StructuralEq for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
impl<T> StructuralPartialEq for GeometryCollection<T> where
T: CoordNum,
[src]
T: CoordNum,
Auto Trait Implementations
impl<T> RefUnwindSafe for GeometryCollection<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for GeometryCollection<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for GeometryCollection<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for GeometryCollection<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for GeometryCollection<T> where
T: UnwindSafe,
[src]
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>,