File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,18 @@ impl<'cx> AutoRealm<'cx> {
9696
9797 /// If we can get &mut AutoRealm then we are current realm,
9898 /// because if there existed other current realm, we couldn't get &mut AutoRealm.
99- pub fn current_realm ( & ' cx mut self ) -> CurrentRealm < ' cx > {
99+ /// ```
100+ /// use mozjs::context::JSContext;
101+ /// use mozjs::jsapi::JSObject;
102+ /// use mozjs::realm::AutoRealm;
103+ /// use std::ptr::NonNull;
104+ ///
105+ /// fn f(cx: &mut JSContext, t: NonNull<JSObject>) {
106+ /// let mut realm = AutoRealm::new(cx, t);
107+ /// let mut current_realm = realm.current_realm();
108+ /// }
109+ /// ```
110+ pub fn current_realm ( & ' _ mut self ) -> CurrentRealm < ' _ > {
100111 CurrentRealm :: assert ( self )
101112 }
102113
You can’t perform that action at this time.
0 commit comments