tree search

This commit is contained in:
2024-11-22 06:38:43 +01:00
parent d13f83b37c
commit 84148636c7
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "osui-element"
version = "0.1.7"
version = "0.1.8"
edition = "2021"
description = "The element attribute for defining elements in OSUI"
license = "Apache-2.0"
+3 -4
View File
@@ -81,12 +81,11 @@ pub fn element(_args: TokenStream, input: TokenStream) -> TokenStream {
}
}
fn get_element_by_id(&mut self, id: &str) -> Option<&mut Element> {
if self.id == id {
return Some(self);
}
if let Children::Children(children, _) = &mut self.children {
for elem in children {
if let Some(e) = elem.get_element_by_id(id) {
if elem.get_data().2 == id {
return Some(elem);
} else if let Some(e) = elem.get_element_by_id(id) {
return Some(e);
}
}