fn on_boost_pickup(boost: Box<BoostPickupWrapper>, car: Box<CarWrapper>) {
    let boost_type = BoostType::from(boost.get_boost_type());

    let is_unlucky = match boost_type {
        BoostType::BIG => roll_big_boost(),
        BoostType::PAD => roll_pad(),
    };

    if is_unlucky {
        // Since CarWrapper implements RBactor (RBactor is a component of CarWrapper),
        // we can just pass the adress of the CarWrapper as the RBactor 
        car.demolish2(car.addr(), 0);
    }
}
// The first parameter for the callback is the event caller
The first parameter for the callback is the event caller
The first parameter for the callback is the event caller
fn on_boost_pickup(boost: Box<BoostPickupWrapper>, car: Box<CarWrapper>) {
    let boost_type = BoostType::from(boost.get_boost_type());
    let is_unlucky = match boost_type {
        BoostType::BIG => roll_big_boost(),
        BoostType::PAD => roll_pad(),
    };
    if is_unlucky {
        // Since CarWrapper implements RBactor (RBactor is a component of CarWrapper),
        // we can just pass the adress of the CarWrapper as the RBactor 
        car.demolish2(car.addr(), 0);
    }
}
fn on_boost_pickup ( boost : Box < BoostPickupWrapper > , car : Box < CarWrapper > ) { let boost_type = BoostType :: from ( boost . get_boost_type ( ) ) ; let is_unlucky = match boost_type { BoostType :: BIG => roll_big_boost ( ) , BoostType :: PAD => roll_pad ( ) , } ; if is_unlucky { // Since CarWrapper implements RBactor (RBactor is a component of CarWrapper), // we can just pass the adress of the CarWrapper as the RBactor  car . demolish2 ( car . addr ( ) , 0 ) ; } }
The first parameter for the callback is the event caller
The first parameter for the callback is the event caller
boost
Box<BoostPickupWrapper>
car
Box<CarWrapper>
boost
Box<BoostPickupWrapper>
car
Box<CarWrapper>