[][src]Struct shapefile::writer::Writer

pub struct Writer<T: Write> {
    pub dest: T,
    // some fields omitted
}

struct that writes the shapes

Fields

dest: T

Methods

impl<T: Write> Writer<T>[src]

pub fn new(dest: T) -> Self[src]

Creates a writer that can be used to write a new shapefile.

The dest argument is only for the .shp

pub fn write_shapes<S: EsriShape>(
    &mut self,
    shapes: Vec<S>
) -> Result<(), Error>
[src]

Writes the shapes to the file

Examples

use shapefile::Point;
let mut writer = shapefile::Writer::from_path("points.shp").unwrap();
let points = vec![Point::new(0.0, 0.0), Point::new(1.0, 0.0), Point::new(2.0, 0.0)];

writer.write_shapes(points).unwrap();
use shapefile::{Point, Polyline};
let mut writer = shapefile::Writer::from_path("polylines.shp").unwrap();
let points = vec![Point::new(0.0, 0.0), Point::new(1.0, 0.0), Point::new(2.0, 0.0)];
let polyline = Polyline::new(points, vec![0]);

writer.write_shapes(vec![polyline]).unwrap();

pub fn write_shapes_and_records<S: EsriShape>(
    self,
    shapes: Vec<S>,
    records: Vec<Record>
) -> Result<(), Error>
[src]

pub fn add_index_dest(&mut self, dest: T)[src]

Adds dest as the destination where the index file will be written

pub fn add_dbase_dest(&mut self, dest: T)[src]

Adds dest as the destination where the dbase content will be written

impl Writer<BufWriter<File>>[src]

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

Creates a new writer from a path. Creates both a .shp and .shx files

Examples

let writer = shapefile::Writer::from_path("/dev/null");

Auto Trait Implementations

impl<T> Sync for Writer<T> where
    T: Sync

impl<T> Send for Writer<T> where
    T: Send

impl<T> Unpin for Writer<T> where
    T: Unpin

impl<T> RefUnwindSafe for Writer<T> where
    T: RefUnwindSafe

impl<T> UnwindSafe for Writer<T> where
    T: UnwindSafe

Blanket Implementations

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.

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

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

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