pub struct GameRuntime {
pub game: GameState,
pub loop_state: GameLoop,
pub agents: Vec<Box<dyn PlayerAgent>>,
}Expand description
Owns the live state and runtime services for one game session.
This is an additive facade over the existing GameState + GameLoop
split. It intentionally keeps GameLoop::run(&mut GameState, ...)
available so callers can migrate incrementally.
Fields§
§game: GameState§loop_state: GameLoop§agents: Vec<Box<dyn PlayerAgent>>Implementations§
Source§impl GameRuntime
impl GameRuntime
pub fn from_parts( game: GameState, loop_state: GameLoop, agents: Vec<Box<dyn PlayerAgent>>, ) -> Self
pub fn run(&mut self, rng: &mut impl Rng, max_turns: u32) -> Option<PlayerId>
pub fn run_opening_hand_actions(&mut self)
pub fn run_turn(&mut self, rng: &mut impl Rng)
pub fn game(&self) -> &GameState
pub fn game_mut(&mut self) -> &mut GameState
pub fn loop_state(&self) -> &GameLoop
pub fn loop_state_mut(&mut self) -> &mut GameLoop
pub fn agents(&self) -> &[Box<dyn PlayerAgent>]
pub fn agents_mut(&mut self) -> &mut [Box<dyn PlayerAgent>]
pub fn into_parts(self) -> (GameState, GameLoop, Vec<Box<dyn PlayerAgent>>)
Auto Trait Implementations§
impl !RefUnwindSafe for GameRuntime
impl !Send for GameRuntime
impl !Sync for GameRuntime
impl !UnwindSafe for GameRuntime
impl Freeze for GameRuntime
impl Unpin for GameRuntime
impl UnsafeUnpin for GameRuntime
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.