Context::from_ref

This commit is contained in:
Quaternions 2024-10-04 16:32:49 -07:00
parent db8e22c34d
commit 7d67e762b1

View File

@ -31,6 +31,9 @@ impl Context{
); );
(Context{dom},crate::runner::instance::Script::new(script_ref),services) (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{ pub fn from_mut(dom:&mut WeakDom)->&mut Context{
unsafe{&mut *(dom as *mut WeakDom as *mut Context)} unsafe{&mut *(dom as *mut WeakDom as *mut Context)}
} }