From 246b6b7b8286e150f090e418567792d54ccf6fa4 Mon Sep 17 00:00:00 2001 From: Zakaria Mansouri Date: Sat, 15 Feb 2025 12:37:31 +0100 Subject: [PATCH] Rename function to get_node_children_by_path for clarity --- rust/Cargo.lock | 2 +- rust/Cargo.toml | 2 +- rust/build.rs | 2 +- rust/src/static/_auto_generated/data.rs | 2 +- rust/src/static/api/mod.rs | 12 ++++++++++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a49f39f..ac4e496 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -41,7 +41,7 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "kuliya" -version = "0.1.2" +version = "0.1.3" dependencies = [ "nest_struct", "serde", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 30d9ba4..bfa618e 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kuliya" description = "A library for querying Algerian education dataset." -version = "0.1.2" +version = "0.1.3" edition = "2021" license = "MIT" diff --git a/rust/build.rs b/rust/build.rs index e93d2cc..f0f5794 100644 --- a/rust/build.rs +++ b/rust/build.rs @@ -158,7 +158,7 @@ pub fn get_node_by_path(path: &str) -> Option<&Node> {{ }} }} -pub fn get_children_by_path(path: &str) -> Vec<&Node> {{ +pub fn get_node_children_by_path(path: &str) -> Vec<&Node> {{ match path {{ {} _ => vec![], }} diff --git a/rust/src/static/_auto_generated/data.rs b/rust/src/static/_auto_generated/data.rs index 75e2a5f..aa8bff1 100644 --- a/rust/src/static/_auto_generated/data.rs +++ b/rust/src/static/_auto_generated/data.rs @@ -1859,7 +1859,7 @@ pub fn get_node_by_path(path: &str) -> Option<&Node> { } } -pub fn get_children_by_path(path: &str) -> Vec<&Node> { +pub fn get_node_children_by_path(path: &str) -> Vec<&Node> { match path { "ua2aks" => vec![&UA2AKS_FLE, &UA2AKS_IT, &UA2AKS_IA, &UA2AKS_FSS, &UA2AKS_FSH, &UA2AKS_FALAOL], "ua2aks/falaol" => vec![&UA2AKS_FALAOL_DTS, &UA2AKS_FALAOL_DART, &UA2AKS_FALAOL_DTRL, &UA2AKS_FALAOL_DALA], diff --git a/rust/src/static/api/mod.rs b/rust/src/static/api/mod.rs index 2867cdb..eac4a9f 100644 --- a/rust/src/static/api/mod.rs +++ b/rust/src/static/api/mod.rs @@ -16,6 +16,18 @@ pub fn get_node_by_path(path: &str) -> Option<&Node> { _auto_generated::data::get_node_by_path(path) } +/// Retrieves the children of a node by its path. +/// # Arguments +/// +/// * `path` - A string slice that holds the path of the node. +/// +/// # Returns +/// +/// * `Vec<&Node>` - A vector of references to the children nodes. +pub fn get_node_children_by_path(path: &str) -> Vec<&Node> { + _auto_generated::data::get_node_children_by_path(path) +} + #[cfg(test)] mod test { use super::get_node_by_path;