add number stops from args
This commit is contained in:
+5
-5
@@ -85,15 +85,15 @@ pub struct PointFinderResponse {
|
||||
pub struct Point {
|
||||
pub stopid: String,
|
||||
pub name: String,
|
||||
pub area: Option<String>,
|
||||
pub area: String,
|
||||
}
|
||||
|
||||
impl From<(&str, &str, Option<&str>)> for Point {
|
||||
fn from(value: (&str, &str, Option<&str>)) -> Self {
|
||||
impl From<(&str, &str, &str)> for Point {
|
||||
fn from(value: (&str, &str, &str)) -> Self {
|
||||
Self {
|
||||
stopid: value.0.into(),
|
||||
name: value.1.into(),
|
||||
area: value.2.map(|s| s.into()),
|
||||
area: value.2.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ fn extract_data_from_response(line: &str) -> Result<Point> {
|
||||
let mut iter = line.trim_start_matches("\\\"").split_terminator('|');
|
||||
|
||||
let stopid = iter.next().context("getting stopid from line")?;
|
||||
let area = iter.nth(1).context("getting area from line").ok();
|
||||
let area = iter.nth(1).context("getting area from line")?;
|
||||
let name = iter.next().context("getting stop name from line")?;
|
||||
Ok((stopid, name, area).into())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user