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§
sourcefn close(&mut self) -> Result<(), OSMWriteError>
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
.
sourcefn is_open(&self) -> bool
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.
sourcefn write_obj(&mut self, obj: &impl OSMObj) -> Result<(), OSMWriteError>
fn write_obj(&mut self, obj: &impl OSMObj) -> Result<(), OSMWriteError>
Write an OSM object to this.
sourcefn into_inner(self) -> W
fn into_inner(self) -> W
Convert back to the underlying writer object
Provided Methods§
fn set_header(&mut self, _key_value: (&str, &str)) -> Result<(), OSMWriteError>
Object Safety§
This trait is not object safe.