It makes it somewhat combersome at the moment to process node/way/relation vs densenode - requiring complex code paths to handle both cases. I would like to propose a common ElementInfo trait that has just a few changes from the current API:
Unlike dense node, all values are optional
Unlike dense node AND other element types, a call to user does not return an error, but simply None
pub trait ElementInfo<'a> {
/// Returns the version of this element.
fn version(&self) -> Option<i32>;
/// Returns the changeset id.
fn changeset(&self) -> Option<i64>;
/// Returns the user id.
fn uid(&self) -> Option<i32>;
/// Returns the user name.
fn user(&self) -> Option<&'a str>;
/// Returns the time stamp in milliseconds since the epoch.
fn milli_timestamp(&self) -> Option<i64>;
/// Returns the visibility status of an element. This is only relevant if the PBF file contains
/// historical information.
fn visible(&self) -> Option<bool>;
/// Returns true if the element was deleted.
/// This is a convenience function that just returns the inverse of `DenseNodeInfo::visible`.
fn deleted(&self) -> Option<bool>;
}
Ideally, the same should be done for DenseNode vs Node - if possible to do efficiently (?), the internal details of the dense/nondense implementation shouldn't leak out.
It makes it somewhat combersome at the moment to process node/way/relation vs densenode - requiring complex code paths to handle both cases. I would like to propose a common
ElementInfo
trait that has just a few changes from the current API:None
Ideally, the same should be done for DenseNode vs Node - if possible to do efficiently (?), the internal details of the dense/nondense implementation shouldn't leak out.