pub struct SimFlags {
load_path: Option<String>,
pub load: String,
pub scenario_modifiers: Vec<ScenarioModifier>,
pub rng_seed: u64,
pub opts: SimOptions,
}
Expand description
SimFlags specifies a simulation to setup. After parsing from structopt, you must call
initialize
.
Fields§
§load_path: Option<String>
A path to some file:
- some kind of map: start an empty simulation on the map
- a scenario
- a savestate: restore the simulation exactly from some savestate
load: String
The same as load_path
, but with a default value filled out. Call initialize
to set this
up.
scenario_modifiers: Vec<ScenarioModifier>
A JSON list of modifiers to transform the scenario. These can be generated with the GUI.
rng_seed: u64
An arbitrary number to seed the random number generator. This is input to the deterministic simulation, so different values affect results.
opts: SimOptions
Implementations§
source§impl SimFlags
impl SimFlags
pub const RNG_SEED: u64 = 42u64
pub fn initialize(&mut self)
pub fn for_test(run_name: &str) -> SimFlags
pub fn make_rng(&self) -> XorShiftRng
sourcepub fn load_synchronously(
&self,
timer: &mut Timer<'_>
) -> (Map, Sim, XorShiftRng)
pub fn load_synchronously( &self, timer: &mut Timer<'_> ) -> (Map, Sim, XorShiftRng)
Loads a map and simulation. Not appropriate for use in the UI or on web.
Trait Implementations§
source§impl StructOpt for SimFlags
impl StructOpt for SimFlags
source§fn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
Builds the struct from
clap::ArgMatches
. It’s guaranteed to succeed
if matches
originates from an App
generated by [StructOpt::clap
] called on
the same type, otherwise it must panic.§fn from_args() -> Selfwhere
Self: Sized,
fn from_args() -> Selfwhere
Self: Sized,
Builds the struct from the command line arguments (
std::env::args_os
).
Calls clap::Error::exit
on failure, printing the error message and aborting the program.§fn from_args_safe() -> Result<Self, Error>where
Self: Sized,
fn from_args_safe() -> Result<Self, Error>where
Self: Sized,
Builds the struct from the command line arguments (
std::env::args_os
).
Unlike [StructOpt::from_args
], returns clap::Error
on failure instead of aborting the program,
so calling .exit
is up to you.§fn from_iter<I>(iter: I) -> Self
fn from_iter<I>(iter: I) -> Self
Gets the struct from any iterator such as a
Vec
of your making.
Print the error message and quit the program in case of failure. Read more§fn from_iter_safe<I>(iter: I) -> Result<Self, Error>
fn from_iter_safe<I>(iter: I) -> Result<Self, Error>
Gets the struct from any iterator such as a
Vec
of your making. Read moreAuto Trait Implementations§
impl Freeze for SimFlags
impl RefUnwindSafe for SimFlags
impl Send for SimFlags
impl Sync for SimFlags
impl Unpin for SimFlags
impl UnwindSafe for SimFlags
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.