From a88debe9f160c79fc15e3355440f3950752d26ed Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 3 Oct 2024 21:35:00 -0700 Subject: [PATCH] Services::find_in --- src/place.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/place.rs b/src/place.rs index 1fa0979..6961609 100644 --- a/src/place.rs +++ b/src/place.rs @@ -5,6 +5,16 @@ pub struct Services{ pub game:Ref, pub workspace:Ref, } +impl Services{ + pub fn find_in(dom:&WeakDom)->Option{ + Some(Services{ + workspace:*dom.root().children().iter().find(|&&r| + dom.get_by_ref(r).is_some_and(|instance|instance.class=="Workspace") + )?, + game:dom.root_ref(), + }) + } +} pub fn new_place_with_instances_in_workspace(mut instance_dom:WeakDom)->(WeakDom,Services){ //workspace