Struct geo_types::GeometryCollection
source · [−]Expand description
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]);Tuple Fields
0: Vec<Geometry<T>>Implementations
sourceimpl<T: CoordNum> GeometryCollection<T>
impl<T: CoordNum> GeometryCollection<T>
sourceimpl<'a, T: CoordNum> GeometryCollection<T>
impl<'a, T: CoordNum> GeometryCollection<T>
Trait Implementations
sourceimpl<T: Clone> Clone for GeometryCollection<T> where
T: CoordNum,
impl<T: Clone> Clone for GeometryCollection<T> where
T: CoordNum,
sourcefn clone(&self) -> GeometryCollection<T>
fn clone(&self) -> GeometryCollection<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<T: Debug> Debug for GeometryCollection<T> where
T: CoordNum,
impl<T: Debug> Debug for GeometryCollection<T> where
T: CoordNum,
sourceimpl<T: CoordNum> Default for GeometryCollection<T>
impl<T: CoordNum> Default for GeometryCollection<T>
sourceimpl<T: CoordNum, IG: Into<Geometry<T>>> From<IG> for GeometryCollection<T>
impl<T: CoordNum, IG: Into<Geometry<T>>> From<IG> for GeometryCollection<T>
Convert any Geometry (or anything that can be converted to a Geometry) into a GeometryCollection
sourceimpl<T: CoordNum, IG: Into<Geometry<T>>> FromIterator<IG> for GeometryCollection<T>
impl<T: CoordNum, IG: Into<Geometry<T>>> FromIterator<IG> for GeometryCollection<T>
Collect Geometries (or what can be converted to a Geometry) into a GeometryCollection
sourcefn from_iter<I: IntoIterator<Item = IG>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = IG>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl<T: Hash> Hash for GeometryCollection<T> where
T: CoordNum,
impl<T: Hash> Hash for GeometryCollection<T> where
T: CoordNum,
sourceimpl<T: CoordNum> Index<usize> for GeometryCollection<T>
impl<T: CoordNum> Index<usize> for GeometryCollection<T>
sourceimpl<T: CoordNum> IndexMut<usize> for GeometryCollection<T>
impl<T: CoordNum> IndexMut<usize> for GeometryCollection<T>
sourceimpl<T: CoordNum> IntoIterator for GeometryCollection<T>
impl<T: CoordNum> IntoIterator for GeometryCollection<T>
sourceimpl<'a, T: CoordNum> IntoIterator for &'a GeometryCollection<T>
impl<'a, T: CoordNum> IntoIterator for &'a GeometryCollection<T>
sourceimpl<'a, T: CoordNum> IntoIterator for &'a mut GeometryCollection<T>
impl<'a, T: CoordNum> IntoIterator for &'a mut GeometryCollection<T>
sourceimpl<T: PartialEq> PartialEq<GeometryCollection<T>> for GeometryCollection<T> where
T: CoordNum,
impl<T: PartialEq> PartialEq<GeometryCollection<T>> for GeometryCollection<T> where
T: CoordNum,
sourcefn eq(&self, other: &GeometryCollection<T>) -> bool
fn eq(&self, other: &GeometryCollection<T>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &GeometryCollection<T>) -> bool
fn ne(&self, other: &GeometryCollection<T>) -> bool
This method tests for !=.
impl<T: Eq> Eq for GeometryCollection<T> where
T: CoordNum,
impl<T> StructuralEq for GeometryCollection<T> where
T: CoordNum,
impl<T> StructuralPartialEq for GeometryCollection<T> where
T: CoordNum,
Auto Trait Implementations
impl<T> RefUnwindSafe for GeometryCollection<T> where
T: RefUnwindSafe,
impl<T> Send for GeometryCollection<T> where
T: Send,
impl<T> Sync for GeometryCollection<T> where
T: Sync,
impl<T> Unpin for GeometryCollection<T> where
T: Unpin,
impl<T> UnwindSafe for GeometryCollection<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
