From 7d67e762b14811f37d2b11658319f88f865acbc3 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 4 Oct 2024 16:32:49 -0700 Subject: [PATCH] Context::from_ref --- src/context.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/context.rs b/src/context.rs index 9e0b05c..44458b9 100644 --- a/src/context.rs +++ b/src/context.rs @@ -31,6 +31,9 @@ impl Context{ ); (Context{dom},crate::runner::instance::Script::new(script_ref),services) } + pub fn from_ref(dom:&WeakDom)->&Context{ + unsafe{&*(dom as *const WeakDom as *const Context)} + } pub fn from_mut(dom:&mut WeakDom)->&mut Context{ unsafe{&mut *(dom as *mut WeakDom as *mut Context)} }