@@ -54,7 +54,7 @@ fn usage(exe_name: &str) {
54
54
55
55
/// This trait is designed to allow choosing implementation of underlying storing of World: shared between threads or owned only by WorldOwner.
56
56
pub trait WorldOwner {
57
- fn get < ' a : ' b , ' b > ( & ' a mut self ) -> Box < DerefMut < Target = World < f32 > > + ' b > ;
57
+ fn get_mut < ' a : ' b , ' b > ( & ' a mut self ) -> Box < DerefMut < Target = World < f32 > > + ' b > ;
58
58
}
59
59
60
60
#[ derive( Clone ) ]
@@ -69,7 +69,7 @@ impl WorldOwnerShared {
69
69
}
70
70
71
71
impl WorldOwner for WorldOwnerShared {
72
- fn get < ' a : ' b , ' b > ( & ' a mut self ) -> Box < DerefMut < Target = World < f32 > > + ' b > {
72
+ fn get_mut < ' a : ' b , ' b > ( & ' a mut self ) -> Box < DerefMut < Target = World < f32 > > + ' b > {
73
73
Box :: new ( self . world . lock ( ) . unwrap ( ) )
74
74
}
75
75
}
@@ -85,7 +85,7 @@ impl WorldOwnerExclusive {
85
85
}
86
86
87
87
impl WorldOwner for WorldOwnerExclusive {
88
- fn get < ' a : ' b , ' b > ( & ' a mut self ) -> Box < DerefMut < Target = World < f32 > > + ' b > {
88
+ fn get_mut < ' a : ' b , ' b > ( & ' a mut self ) -> Box < DerefMut < Target = World < f32 > > + ' b > {
89
89
Box :: new ( & mut self . world )
90
90
}
91
91
}
@@ -158,7 +158,7 @@ impl Testbed {
158
158
159
159
pub fn set_world ( & mut self , world : Box < WorldOwner > ) {
160
160
self . world = world;
161
- let mut world = self . world . get ( ) ;
161
+ let mut world = self . world . get_mut ( ) ;
162
162
world. enable_performance_counters ( ) ;
163
163
164
164
self . graphics . clear ( self . window . as_mut ( ) . unwrap ( ) ) ;
@@ -276,7 +276,7 @@ impl State for Testbed {
276
276
// graphics.add(window, WorldObject::RigidBody(body));
277
277
// },
278
278
WindowEvent :: MouseButton ( _, Action :: Press , modifier) => {
279
- let mut physics_world = & mut self . world . get ( ) ;
279
+ let mut physics_world = & mut self . world . get_mut ( ) ;
280
280
let mapped_point = self
281
281
. graphics
282
282
. camera ( )
@@ -349,7 +349,7 @@ impl State for Testbed {
349
349
}
350
350
}
351
351
WindowEvent :: MouseButton ( _, Action :: Release , _) => {
352
- let mut physics_world = & mut self . world . get ( ) ;
352
+ let mut physics_world = & mut self . world . get_mut ( ) ;
353
353
if let Some ( body) = self . grabbed_object {
354
354
for n in self
355
355
. graphics
@@ -369,7 +369,7 @@ impl State for Testbed {
369
369
self . grabbed_object_constraint = None ;
370
370
}
371
371
WindowEvent :: CursorPos ( x, y, modifiers) => {
372
- let mut physics_world = & mut self . world . get ( ) ;
372
+ let mut physics_world = & mut self . world . get_mut ( ) ;
373
373
self . cursor_pos . x = x as f32 ;
374
374
self . cursor_pos . y = y as f32 ;
375
375
@@ -410,7 +410,7 @@ impl State for Testbed {
410
410
// // }
411
411
// },
412
412
WindowEvent :: Key ( Key :: Space , Action :: Release , _) => {
413
- let mut physics_world = & mut self . world . get ( ) ;
413
+ let mut physics_world = & mut self . world . get_mut ( ) ;
414
414
self . draw_colls = !self . draw_colls ;
415
415
for co in physics_world. colliders ( ) {
416
416
// FIXME: ugly clone.
@@ -482,13 +482,13 @@ impl State for Testbed {
482
482
for f in & self . callbacks {
483
483
f ( & mut self . graphics , self . time )
484
484
}
485
- self . world . get ( ) . step ( ) ;
485
+ self . world . get_mut ( ) . step ( ) ;
486
486
if !self . hide_counters {
487
- println ! ( "{}" , self . world. get ( ) . performance_counters( ) ) ;
487
+ println ! ( "{}" , self . world. get_mut ( ) . performance_counters( ) ) ;
488
488
}
489
- self . time += self . world . get ( ) . timestep ( ) ;
489
+ self . time += self . world . get_mut ( ) . timestep ( ) ;
490
490
}
491
- let physics_world = & self . world . get ( ) ;
491
+ let physics_world = & self . world . get_mut ( ) ;
492
492
493
493
for co in physics_world. colliders ( ) {
494
494
if self . graphics . body_nodes_mut ( physics_world, co. data ( ) . body ( ) ) . is_none ( ) {
@@ -502,7 +502,7 @@ impl State for Testbed {
502
502
if self . draw_colls {
503
503
draw_collisions (
504
504
window,
505
- & mut self . world . get ( ) ,
505
+ & mut self . world . get_mut ( ) ,
506
506
& mut self . persistant_contacts ,
507
507
self . running != RunMode :: Stop ,
508
508
) ;
@@ -520,7 +520,7 @@ impl State for Testbed {
520
520
& format ! (
521
521
"Simulation time: {:.*}sec." ,
522
522
4 ,
523
- self . world. get ( ) . performance_counters( ) . step_time( ) ,
523
+ self . world. get_mut ( ) . performance_counters( ) . step_time( ) ,
524
524
) [ ..] ,
525
525
& Point2 :: origin ( ) ,
526
526
60.0 ,
0 commit comments