Added doxygen comments

This commit is contained in:
Ollo
2026-02-28 21:49:48 +01:00
parent 4306d866a8
commit fd5b12e875

View File

@@ -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<u64> {
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<u64> {
.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<bool>) -> NextDeparture {
let st_now = SystemTime::now();
let seconds = st_now.duration_since(UNIX_EPOCH).unwrap().as_secs();