From fd5b12e8757677311961a8bac04f3fa7d90f9e77 Mon Sep 17 00:00:00 2001 From: Ollo Date: Sat, 28 Feb 2026 21:49:48 +0100 Subject: [PATCH] Added doxygen comments --- src/straba.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/straba.rs b/src/straba.rs index f895652..68a50e2 100644 --- a/src/straba.rs +++ b/src/straba.rs @@ -108,8 +108,20 @@ pub struct StationLookupItem { /******************************************************** * Global Functions -********************************************************/ +*********************************************************/ +// +/// Looks up a station ID by its name using the RNV API. +/// +/// # Arguments +/// * `station_name` - The name of the station to look up +/// +/// # Returns +/// * `Some(u64)` - The station ID if found +/// * `None` - If the station was not found or an error occurred +/// +/// # See Also +/// Use the returned ID with [`fetch_data`] to get departure information pub fn lookup_station_id(station_name: &str) -> Option { let url = format!("{}{}", LOOKUP_STATION_URL, station_name); let result = reqwest::blocking::get(&url).ok()?; @@ -142,6 +154,18 @@ pub fn lookup_station_id(station_name: &str) -> Option { .and_then(|s| s.id.parse().ok()) } +// +/// Fetches departure data for a given station ID from the RNV API. +/// +/// # Arguments +/// * `station_id` - The ID of the station to fetch departures for +/// * `debug_print` - Optional boolean to enable debug output +/// +/// # Returns +/// `NextDeparture` struct containing the departure information +/// +/// # See Also +/// Use [`lookup_station_id`] to obtain a valid station ID from a station name pub fn fetch_data(station_id: u64, debug_print: Option) -> NextDeparture { let st_now = SystemTime::now(); let seconds = st_now.duration_since(UNIX_EPOCH).unwrap().as_secs();