pub struct Game { /* private fields */ }
Expand description
Main representation of a Line Rider game.
Implementations§
Source§impl Game
impl Game
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new version of the game that can be instantiated and have lines added to.
Sourcepub fn add_lines<'a, T: Iterator<Item = &'a Line>>(&mut self, lines: T)
pub fn add_lines<'a, T: Iterator<Item = &'a Line>>(&mut self, lines: T)
Add several lines to the game.
Sourcepub fn add_riders<'a, T: Iterator<Item = &'a Rider>>(&mut self, riders: T)
pub fn add_riders<'a, T: Iterator<Item = &'a Rider>>(&mut self, riders: T)
Add several riders to the game.
Sourcepub fn construct_game(&self) -> String
pub fn construct_game(&self) -> String
Construct JSON representation of game that can be imported.
Sourcepub fn write_to_file(&self, filename: &str) -> Result<()>
pub fn write_to_file(&self, filename: &str) -> Result<()>
Writes the JSON representation to a given filename.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Game
impl RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl UnwindSafe for Game
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