1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use serde::Serialize;
use crate::Error;
use fetch::fetch_schedules_in_stop;
use parse::parse_html;
use crate::lines;
mod fetch;
mod parse;
#[derive(Debug, PartialEq, Serialize)]
pub struct Schedule {
line: lines::Code,
time: String,
destination: String,
stop: String,
}
pub fn fetch_next_buses(stop_code: &str) -> Result<Vec<Schedule>, Error> {
let html = fetch_schedules_in_stop(stop_code, None)?;
parse_html(stop_code, &html)
}