@@ -155,8 +155,18 @@ impl<T: NativeClass> Instance<T> {
155155 }
156156
157157 /// Calls a function with a NativeClass instance and its owner, and returns its return
158- /// value. Can be used for multiple times via aliasing. For reference-counted types
159- /// behaves like the safe `map`, which should be preferred.
158+ /// value. Can be used for multiple times via aliasing:
159+ ///
160+ /// ```ignore
161+ /// unsafe {
162+ /// instance.map_aliased(/* ... */);
163+ /// // instance.owner may be invalid now, but you can still:
164+ /// instance.map_aliased(/* ... */);
165+ /// instance.map_aliased(/* ... */); // ...for multiple times
166+ /// }
167+ /// ```
168+ ///
169+ /// For reference-counted types behaves like the safe `map`, which should be preferred.
160170 pub unsafe fn map_aliased < F , U > ( & self , op : F ) -> Result < U , <T :: UserData as Map >:: Err >
161171 where
162172 T :: UserData : Map ,
@@ -166,8 +176,18 @@ impl<T: NativeClass> Instance<T> {
166176 }
167177
168178 /// Calls a function with a NativeClass instance and its owner, and returns its return
169- /// value. Can be used for multiple times via aliasing. For reference-counted types
170- /// behaves like the safe `map`, which should be preferred.
179+ /// value. Can be used for multiple times via aliasing:
180+ ///
181+ /// ```ignore
182+ /// unsafe {
183+ /// instance.map_mut_aliased(/* ... */);
184+ /// // instance.owner may be invalid now, but you can still:
185+ /// instance.map_mut_aliased(/* ... */);
186+ /// instance.map_mut_aliased(/* ... */); // ...for multiple times
187+ /// }
188+ /// ```
189+ ///
190+ /// For reference-counted types behaves like the safe `map_mut`, which should be preferred.
171191 pub unsafe fn map_mut_aliased < F , U > ( & self , op : F ) -> Result < U , <T :: UserData as MapMut >:: Err >
172192 where
173193 T :: UserData : MapMut ,
0 commit comments