pub trait Node: OSMObjBase {
// Required methods
fn lat_lon(&self) -> Option<(Lat, Lon)>;
fn set_lat_lon_direct(&mut self, loc: Option<(Lat, Lon)>);
// Provided methods
fn lat_lon_f64(&self) -> Option<(f64, f64)> { ... }
fn has_lat_lon(&self) -> bool { ... }
fn unset_lat_lon(&mut self) { ... }
fn set_lat_lon<LL, L1, L2>(
&mut self,
loc: LL
) -> Result<(), ParseLatLonError>
where L1: TryInto<Lat>,
L2: TryInto<Lon>,
LL: Into<Option<(L1, L2)>>,
ParseLatLonError: From<<L1 as TryInto<Lat>>::Error> + From<<L2 as TryInto<Lon>>::Error> { ... }
}
Expand description
A Node
Required Methods§
sourcefn set_lat_lon_direct(&mut self, loc: Option<(Lat, Lon)>)
fn set_lat_lon_direct(&mut self, loc: Option<(Lat, Lon)>)
Directly set the lat & lon of the node, see set_lat_lon()
as a more convienient method.
Provided Methods§
sourcefn lat_lon_f64(&self) -> Option<(f64, f64)>
fn lat_lon_f64(&self) -> Option<(f64, f64)>
Latitude & Longitude of the node as f64
(if it’s set)
sourcefn has_lat_lon(&self) -> bool
fn has_lat_lon(&self) -> bool
True iff this node has latitude & longitude set
sourcefn unset_lat_lon(&mut self)
fn unset_lat_lon(&mut self)
Remove the lat & lon for this node
sourcefn set_lat_lon<LL, L1, L2>(&mut self, loc: LL) -> Result<(), ParseLatLonError>where
L1: TryInto<Lat>,
L2: TryInto<Lon>,
LL: Into<Option<(L1, L2)>>,
ParseLatLonError: From<<L1 as TryInto<Lat>>::Error> + From<<L2 as TryInto<Lon>>::Error>,
fn set_lat_lon<LL, L1, L2>(&mut self, loc: LL) -> Result<(), ParseLatLonError>where L1: TryInto<Lat>, L2: TryInto<Lon>, LL: Into<Option<(L1, L2)>>, ParseLatLonError: From<<L1 as TryInto<Lat>>::Error> + From<<L2 as TryInto<Lon>>::Error>,
Set the Latitude & Longitude.
The type signature is complicated so you can convert from f64
use osmio::Node;
// It can convert from f64
node.set_lat_lon((0.0_f64, 0.0_f64));
assert_eq!(node.lat_lon_f64().unwrap(), (0., 0.));
// .. or from f32
node.set_lat_lon((0.0_f32, 0.0_f32));
assert_eq!(node.lat_lon_f64().unwrap(), (0., 0.));
// You can set to None too
node.set_lat_lon(None as Option<(f64, f64)>);
assert!(node.lat_lon_f64().is_none());
Object Safety§
This trait is not object safe.