pub struct MartState<I: Copy + Eq + Hash + Debug> {
pub inventory: MartStock<I>,
pub phase: MartPhase,
}Expand description
Complete mart interaction state machine.
Construct with MartState::new, drive with
MartState::update_frame once per input frame, passing the game’s
MartBackend for all price/capacity/transaction decisions.
Fields§
§inventory: MartStock<I>Items the shop stocks.
phase: MartPhaseImplementations§
Source§impl<I: Copy + Eq + Hash + Debug> MartState<I>
impl<I: Copy + Eq + Hash + Debug> MartState<I>
Sourcepub fn update_frame<B: MartBackend<Item = I>>(
&mut self,
input: MenuInput,
backend: &mut B,
) -> MartUpdate
pub fn update_frame<B: MartBackend<Item = I>>( &mut self, input: MenuInput, backend: &mut B, ) -> MartUpdate
Advance the mart state machine by one frame of input.
backend is consulted for bag contents and is mutated when a
transaction is committed.
Trait Implementations§
impl<I: Eq + Copy + Eq + Hash + Debug> Eq for MartState<I>
impl<I: PartialEq + Copy + Eq + Hash + Debug> StructuralPartialEq for MartState<I>
Auto Trait Implementations§
impl<I> Freeze for MartState<I>
impl<I> RefUnwindSafe for MartState<I>where
MartStock<I>: RefUnwindSafe,
impl<I> Send for MartState<I>
impl<I> Sync for MartState<I>
impl<I> Unpin for MartState<I>
impl<I> UnsafeUnpin for MartState<I>where
MartStock<I>: UnsafeUnpin,
impl<I> UnwindSafe for MartState<I>where
MartStock<I>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more