Trait osmio::OSMWriter

source ·
pub trait OSMWriter<W: Write> {
    // Required methods
    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;

    // 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 { ... }
}
Expand description

A generic writer for OSM objects.

Required Methods§

source

fn new(_: W) -> Self

Create a writer from an underying writer

source

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.

source

fn is_open(&self) -> bool

Return true iff this writer is not 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.

source

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

Write an OSM object to this.

source

fn into_inner(self) -> W

Convert back to the underlying writer object

Provided Methods§

source

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

source

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

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<W: Write> OSMWriter<W> for OSCWriter<W>

source§

impl<W: Write> OSMWriter<W> for XMLWriter<W>