pub fn step(&mut self, tick: Tick) -> UniverseStepInfo {
        let mut info = UniverseStepInfo::default();
        let start_time = Instant::now();

        let mut transactions = Vec::new();

        for space in self.spaces.values() {
            let (space_info, transaction) = space
                .try_borrow_mut()
                .expect("space borrowed during universe.step()")
                .step(Some(&space.downgrade()), tick);
            transactions.push(transaction);
            info.space_step += space_info;
        }

        for character in self.characters.values() {
            // TODO: Make URootRef::downgrade() non-allocating
            let transaction = character
                .try_borrow_mut()
                .expect("character borrowed during universe.step()")
                .step(Some(&character.downgrade()), tick);
            transactions.push(transaction);
        }

        // TODO: Quick hack -- we would actually like to execute non-conflicting transactions and skip conflicting ones...
        for t in transactions {
            if let Err(e) = t.execute(self) {
                // TODO: Need to report these failures back to the source
                // ... and perhaps in the UniverseStepInfo
                log::info!("Transaction failure: {}", e);
            }
        }

        info.computation_time = Instant::now().duration_since(start_time);
        info
    }
/// Advance time for all members.
Advance time for all members.
Advance time for all members .
pub fn step(&mut self, tick: Tick) -> UniverseStepInfo {
        let mut info = UniverseStepInfo::default();
        let start_time = Instant::now();
        let mut transactions = Vec::new();
        for space in self.spaces.values() {
            let (space_info, transaction) = space
                .try_borrow_mut()
                .expect("space borrowed during universe.step()")
                .step(Some(&space.downgrade()), tick);
            transactions.push(transaction);
            info.space_step += space_info;
        }
        for character in self.characters.values() {
            // TODO: Make URootRef::downgrade() non-allocating
            let transaction = character
                .try_borrow_mut()
                .expect("character borrowed during universe.step()")
                .step(Some(&character.downgrade()), tick);
            transactions.push(transaction);
        }
        // TODO: Quick hack -- we would actually like to execute non-conflicting transactions and skip conflicting ones...
        for t in transactions {
            if let Err(e) = t.execute(self) {
                // TODO: Need to report these failures back to the source
                // ... and perhaps in the UniverseStepInfo
                log::info!("Transaction failure: {}", e);
            }
        }
        info.computation_time = Instant::now().duration_since(start_time);
        info
    }
pub fn step ( & mut self , tick : Tick ) -> UniverseStepInfo { let mut info = UniverseStepInfo :: default ( ) ; let start_time = Instant :: now ( ) ; let mut transactions = Vec :: new ( ) ; for space in self . spaces . values ( ) { let ( space_info , transaction ) = space . try_borrow_mut ( ) . expect ( " " ) . step ( Some ( & space . downgrade ( ) ) , tick ) ; transactions . push ( transaction ) ; info . space_step += space_info ; } for character in self . characters . values ( ) { // TODO: Make URootRef::downgrade() non-allocating let transaction = character . try_borrow_mut ( ) . expect ( " " ) . step ( Some ( & character . downgrade ( ) ) , tick ) ; transactions . push ( transaction ) ; } // TODO: Quick hack -- we would actually like to execute non-conflicting transactions and skip conflicting ones... for t in transactions { if let Err ( e ) = t . execute ( self ) { // TODO: Need to report these failures back to the source // ... and perhaps in the UniverseStepInfo log :: info ! ( " " e ) ; } } info . computation_time = Instant :: now ( ) . duration_since ( start_time ) ; info }
Advance time for all members.
Advance time for all members .
&mut self
tick
Tick