Struct millionaire::Player [−][src]
pub struct Player { /* fields omitted */ }
Implementations
impl Player
[src]
impl Player
[src]pub fn stock_balance(&self, stock: &Stock) -> i64
[src]
pub fn stock_balance(&self, stock: &Stock) -> i64
[src]Gets the amount of stock a player owns
pub fn buy_stock(&mut self, stock: &Stock, amount: i64) -> Result<(), ()>
[src]
pub fn buy_stock(&mut self, stock: &Stock, amount: i64) -> Result<(), ()>
[src]Purchases a stock. Returns Err(())
if the player had too low of a balance.
pub fn sell_stock(&mut self, stock: &Stock, amount: i64) -> Result<(), ()>
[src]
pub fn sell_stock(&mut self, stock: &Stock, amount: i64) -> Result<(), ()>
[src]Sells a stock. Returns Err(())
if the player doesn’t have enough stock to sell.
pub fn reset_stock(&mut self, stock: &Stock)
[src]
pub fn reset_stock(&mut self, stock: &Stock)
[src]Resets a stock balance back to 0.
pub fn collect_income(&mut self)
[src]
pub fn collect_income(&mut self)
[src]Increment the balance by the player’s income.
pub fn increase_income(&mut self) -> Result<(), ()>
[src]
pub fn increase_income(&mut self) -> Result<(), ()>
[src]Increases the income of the player by the initial income amount for the cost of 10 times the initial income. Returns an Err(()) if the player didn’t have enough money to increase their income.
pub fn net_worth(&self, stocks: &[Stock]) -> i64
[src]
pub fn net_worth(&self, stocks: &[Stock]) -> i64
[src]Returns the balance of the player plus the worth of the player’s owned stock.
Auto Trait Implementations
impl RefUnwindSafe for Player
impl Send for Player
impl Sync for Player
impl Unpin for Player
impl UnwindSafe for Player
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,