Skip to content

Commit

Permalink
Merge pull request #1 from woshilapin/update_gtfs_parser-from
Browse files Browse the repository at this point in the history
Transform Into implementation into From
  • Loading branch information
patochectp authored Oct 14, 2019
2 parents b2d2d2a + 307195f commit 83c445d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/gtfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ enum StopLocationType {
BoardingArea,
}

impl Into<StopType> for StopLocationType {
fn into(self) -> StopType {
match self {
impl From<StopLocationType> for StopType {
fn from(stop_location_type: StopLocationType) -> StopType {
match stop_location_type {
StopLocationType::StopPoint => StopType::Point,
StopLocationType::StopArea => StopType::Zone,
StopLocationType::StopEntrance => StopType::StopEntrance,
Expand Down
6 changes: 3 additions & 3 deletions src/ntfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ enum StopLocationType {
BoardingArea,
}

impl Into<StopType> for StopLocationType {
fn into(self) -> StopType {
match self {
impl From<StopLocationType> for StopType {
fn from(stop_location_type: StopLocationType) -> StopType {
match stop_location_type {
StopLocationType::StopPoint => StopType::Point,
StopLocationType::StopArea => StopType::Zone,
StopLocationType::GeographicArea => StopType::Zone,
Expand Down
12 changes: 6 additions & 6 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,18 +875,18 @@ impl From<(String, String)> for Coord {
}
}

impl Into<(String, String)> for Coord {
fn into(self) -> (String, String) {
impl From<Coord> for (String, String) {
fn from(coord: Coord) -> Self {
(
if (self.lon - <f64>::default()).abs() < std::f64::EPSILON {
if (coord.lon - <f64>::default()).abs() < std::f64::EPSILON {
"".to_string()
} else {
self.lon.to_string()
coord.lon.to_string()
},
if (self.lat - <f64>::default()).abs() < std::f64::EPSILON {
if (coord.lat - <f64>::default()).abs() < std::f64::EPSILON {
"".to_string()
} else {
self.lat.to_string()
coord.lat.to_string()
},
)
}
Expand Down

0 comments on commit 83c445d

Please sign in to comment.