[][src]Trait osmio::OSMWriter

pub trait OSMWriter<W: Write> {
    fn new(_: W) -> Self;
fn close(&mut self) -> Result<(), OSMWriteError>;
fn is_open(&self) -> bool;
fn write_obj(&mut self, obj: &impl OSMObj) -> Result<(), OSMWriteError>;
fn into_inner(self) -> W; fn set_header(
        &mut self,
        _key_value: (&str, &str)
    ) -> Result<(), OSMWriteError> { ... }
fn from_iter<I: Iterator<Item = impl OSMObj>>(writer: W, iter: I) -> Self
    where
        Self: Sized
, { ... } }

A generic writer for OSM objects.

Required methods

fn new(_: W) -> Self

Create a writer from an underying writer

fn close(&mut self) -> Result<(), OSMWriteError>

Close this writer, cannot write any more objects. Some fileformats have certain 'end of file' things. After you write those, you cannot write any more OSM objects. e.g. an XML file format will require that you close your root XML tag. After calling this method, you cannot add any more OSM objects to this writer, and is_open will return false.

fn is_open(&self) -> bool

Return true iff this writer is closed. If open you should be able to continue to write objects to it. if closed you cannot write any more OSM objects to it.

fn write_obj(&mut self, obj: &impl OSMObj) -> Result<(), OSMWriteError>

Write an OSM object to this.

fn into_inner(self) -> W

Convert back to the underlying writer object

Loading content...

Provided methods

fn set_header(&mut self, _key_value: (&str, &str)) -> Result<(), OSMWriteError>

fn from_iter<I: Iterator<Item = impl OSMObj>>(writer: W, iter: I) -> Self where
    Self: Sized

Create a new OSMWriter, consume all the objects from an OSMObj iterator source, and then close this source. Returns this OSMWriter.

Loading content...

Implementors

impl<W: Write> OSMWriter<W> for OSCWriter<W>[src]

impl<W: Write> OSMWriter<W> for XMLWriter<W>[src]

Loading content...