Created
November 13, 2014 08:32
-
-
Save nulldatamap/792013f2a1d8fb1bbeb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impl MarketData { | |
| … | |
| pub fn collect( &mut self, market : &mut Market ) { | |
| self.day_count += 1; | |
| self.asset_history.push( market.assets ); | |
| self.price_history.push( market.price ); | |
| self.holders_history.push( market.holders ); | |
| } | |
| … | |
| } | |
| … | |
| impl Market { | |
| … | |
| pub fn next_day( &mut self ) { | |
| self.recalculate_price(); | |
| // Can't do that since we've already borrowed self as mutable | |
| self.data.collect( self ); | |
| } | |
| … | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment