[−][src]Trait holding_solar::PlanetStore
Keeps track of CelestialBody
s.
Required methods
fn get_planet(&self, id: PlanetId) -> Option<&CelestialBody>
Get a CelestialBody
from the PlanetStore
.
fn get_planet_mut(&mut self, id: PlanetId) -> Option<&mut CelestialBody>
Get a mutable reference to a CelestialBody
from the PlanetStore
.
fn create_planet(
&mut self,
name: String,
temperature: i32,
rotational_period: usize,
color: Color
) -> &CelestialBody
&mut self,
name: String,
temperature: i32,
rotational_period: usize,
color: Color
) -> &CelestialBody
Create a new CelestialBody
in the PlanetStore
.
Provided methods
fn add_orbit(&mut self, parent_id: PlanetId, child_id: PlanetId, period: usize)
Adds an orbit.
todo(arlyon): Allow this to fail if
- either planet doesn't exist
- the child is orbiting something else