[][src]Struct geozero_shp::reader::Reader

pub struct Reader<T: Read> { /* fields omitted */ }

struct that reads the content of a shapefile

Implementations

impl<T: Read> Reader<T>[src]

pub fn new(source: T) -> Result<Reader<T>, Error>[src]

Creates a new Reader from a source that implements the Read trait

The Shapefile header is read upon creation (but no reading of the Shapes is done)

Errors

Will forward any std::io::Error

Will also return an error if the data is not a shapefile (Wrong file code)

Will also return an error if the shapetype read from the input source is invalid

pub fn header(&self) -> &Header[src]

Returns a non-mutable reference to the header read

pub fn read_records(self) -> Result<Vec<Record>, Error>[src]

Read and return only the records contained in the .dbf file

pub fn iter_geometries<P: FeatureProcessor>(
    self,
    processor: P
) -> ShapeIterator<P, T>

Notable traits for ShapeIterator<P, T>

impl<P: FeatureProcessor, T: Read> Iterator for ShapeIterator<P, T> type Item = Result<(), Error>;
[src]

pub fn iter_features<P: FeatureProcessor>(
    self,
    processor: P
) -> Result<ShapeRecordIterator<P, T>, Error>
[src]

Returns an iterator over the Shapes and their Records

Errors

The Result will be an error if the .dbf wasn't found

pub fn add_index_source(&mut self, source: T) -> Result<(), Error>[src]

Reads the index file from the source This allows to later read shapes by giving their index without reading the whole file

(see read_nth_shape())

pub fn add_dbf_source(&mut self, source: T) -> Result<(), Error>[src]

Adds the source as the source where the dbf record will be read from

impl Reader<BufReader<File>>[src]

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, Error>[src]

Creates a reader from a path to a file

Will attempt to read both the .shx and .dbf associated with the file, if they do not exists the function will not fail, and you will get an error later if you try to use a function that requires the file to be present.

Auto Trait Implementations

impl<T> RefUnwindSafe for Reader<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Reader<T> where
    T: Send
[src]

impl<T> Sync for Reader<T> where
    T: Sync
[src]

impl<T> Unpin for Reader<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Reader<T> where
    T: UnwindSafe
[src]

Blanket Implementations

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

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

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

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

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.