[−][src]Function shapefile::reader::read_as
pub fn read_as<T: AsRef<Path>, S: ReadableShape>(
path: T
) -> Result<Vec<S>, Error>
Function to read all the Shapes in a file as a certain type
Fails and return Err(Error:MismatchShapeType)
Examples
let polylines = shapefile::read_as::<_, shapefile::PolylineZ>("tests/data/polygon.shp"); assert_eq!(polylines.is_err(), true); let polygons = shapefile::read_as::<_, shapefile::Polygon>("tests/data/polygon.shp"); assert_eq!(polygons.is_ok(), true);
If the reading is successful, the returned Vec<S:ReadShape>>
is a vector of actual structs
Useful if you know in at compile time which kind of shape you expect the file to have