From 55e1b5d9cf6912f9de861e4354a8f69a778519ba Mon Sep 17 00:00:00 2001 From: davidemazzocchi Date: Sat, 27 Sep 2025 07:56:20 +0200 Subject: [PATCH] feat: add utility function to read an attribute value from an entity --- 01.workspace/heave/src/str/entity.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/01.workspace/heave/src/str/entity.rs b/01.workspace/heave/src/str/entity.rs index e61f730..5eb8609 100644 --- a/01.workspace/heave/src/str/entity.rs +++ b/01.workspace/heave/src/str/entity.rs @@ -18,4 +18,11 @@ impl O { self.attributes.insert(attribute.id.clone(), attribute); self } + pub fn value_of(&self, id: &str) -> Option<&Value> { + let attribute = self.attributes.get(id); + match attribute { + None => None, + Some(attribute) => Some(&attribute.value), + } + } }