pub fn dispatch(&mut self, mut limit: usize) -> usize {
        while limit > 0 {
            if let Some(event) = self.events.pop_front() {
                let target = Rc::clone(&event.target);
                match target.dispatch(event) {
                    Ok(mut effect) => {
                        while let Some(actor) = effect.actors.pop() {
                            self.actors.push(Rc::downgrade(&actor));
                        }
                        while let Some(event) = effect.events.pop() {
                            self.events.push_back(event);
                        }
                        if let Some(behavior) = effect.update.take() {
                            target.update(behavior);
                        }
                    },
                    Err(reason) => {
                        println!("FAIL! {}", reason);  // FIXME: should deliver a signal to meta-controller
                    },
                }
            } else {
                break;
            }
            limit -= 1;
        }
        self.events.len()  // remaining event count
    }
/// Dispatch up to `limit` events.
///
/// Returns the number of events still waiting in queue.
Dispatch up to `limit` events.
Returns the number of events still waiting in queue.
Dispatch up to ` limit ` events . Returns the number of events still waiting in queue .
pub fn dispatch(&mut self, mut limit: usize) -> usize {
        while limit > 0 {
            if let Some(event) = self.events.pop_front() {
                let target = Rc::clone(&event.target);
                match target.dispatch(event) {
                    Ok(mut effect) => {
                        while let Some(actor) = effect.actors.pop() {
                            self.actors.push(Rc::downgrade(&actor));
                        }
                        while let Some(event) = effect.events.pop() {
                            self.events.push_back(event);
                        }
                        if let Some(behavior) = effect.update.take() {
                            target.update(behavior);
                        }
                    },
                    Err(reason) => {
                        println!("FAIL! {}", reason);  // FIXME: should deliver a signal to meta-controller
                    },
                }
            } else {
                break;
            }
            limit -= 1;
        }
        self.events.len()  // remaining event count
    }
pub fn dispatch ( & mut self , mut limit : usize ) -> usize { while limit > 0 { if let Some ( event ) = self . events . pop_front ( ) { let target = Rc :: clone ( & event . target ) ; match target . dispatch ( event ) { Ok ( mut effect ) => { while let Some ( actor ) = effect . actors . pop ( ) { self . actors . push ( Rc :: downgrade ( & actor ) ) ; } while let Some ( event ) = effect . events . pop ( ) { self . events . push_back ( event ) ; } if let Some ( behavior ) = effect . update . take ( ) { target . update ( behavior ) ; } } , Err ( reason ) => { println ! ( " " reason ) ; // FIXME: should deliver a signal to meta-controller } , } } else { break ; } limit -= 1 ; } self . events . len ( ) // remaining event count }
Dispatch up to `limit` events.
Dispatch up to ` limit ` events .
&mut self
limit
usize