Trait geo::algorithm::map_coords::TryMapCoords[][src]

pub trait TryMapCoords<T, NT> {
    type Output;
    fn try_map_coords(
        &self,
        func: &Fn(&(T, T)) -> Result<(NT, NT), Error>
    ) -> Result<Self::Output, Error>
    where
        T: CoordinateType,
        NT: CoordinateType
; }

Map a fallible function over all the coordinates in a geometry, returning a Result

Associated Types

Required Methods

Map a fallible function over all the coordinates in a geometry, returning a Result

Examples

use geo::Point;
use geo::algorithm::map_coords::TryMapCoords;

let p1 = Point::new(10., 20.);
let p2 = p1.try_map_coords(&|&(x, y)| Ok((x+1000., y*2.))).unwrap();

assert_eq!(p2, Point::new(1010., 40.));

Implementors