Skip to content

Commit

Permalink
Tweak docstrings, names, derives
Browse files Browse the repository at this point in the history
  • Loading branch information
BudgieInWA committed Dec 4, 2022
1 parent f6bcba9 commit 0ea674c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions osm2streets/src/lanes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,12 @@ impl fmt::Display for Direction {
}
}

#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize, Deserialize)]
/// Refers to a lane by its left-to-right position among all lanes in that direction. Backward
/// lanes are counted left-to-right from the backwards direction.
///
/// e.g. The left-most forward lane is `LtrLaneNum::Forward(1)` and the backward lane furthest to
/// the road-right is `LtrLaneNum::Backward(1)`, because of the backward perspective.
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
pub enum LtrLaneNum {
Forward(usize),
Backward(usize),
Expand Down Expand Up @@ -433,7 +438,7 @@ impl LtrLaneNum {
///
/// Most commonly seen as a value of the placement tag, e.g.
/// `placement=right_of:1` means that the OSM way is drawn along the right edge of lane 1.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
pub enum RoadPosition {
/// The center of the carriageway width, ignoring lanes. The default placement of OSM ways.
Center,
Expand Down Expand Up @@ -466,7 +471,7 @@ impl RoadPosition {
}

/// Describes the placement of a line (such as the OSM Way) along a road.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
pub enum Placement {
/// Along the specified position down the entire length.
Consistent(RoadPosition),
Expand Down
2 changes: 1 addition & 1 deletion osm2streets/src/road.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl Road {

/// Calculates the number of (forward, both_ways, backward) lanes. The order of the lanes
/// doesn't matter.
pub fn driving_lane_counts(&self) -> (usize, usize, usize) {
pub fn _travel_lane_counts(&self) -> (usize, usize, usize) {
let mut result = (0, 0, 0);
for lane in &self.lane_specs_ltr {
if !lane.lt.is_tagged_by_lanes_suffix() {
Expand Down

0 comments on commit 0ea674c

Please sign in to comment.