[][src]Trait holding_solar::PlanetStore

pub trait PlanetStore {
    fn get_planet(&self, id: PlanetId) -> Option<&CelestialBody>;
fn get_planet_mut(&mut self, id: PlanetId) -> Option<&mut CelestialBody>;
fn create_planet(
        &mut self,
        name: String,
        temperature: i32,
        rotational_period: usize,
        color: Color
    ) -> &CelestialBody; fn add_orbit(
        &mut self,
        parent_id: PlanetId,
        child_id: PlanetId,
        period: usize
    ) { ... } }

Keeps track of CelestialBodys.

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

Create a new CelestialBody in the PlanetStore.

Loading content...

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
Loading content...

Implementors

Loading content...