[][src]Struct holding_solar::CelestialBody

pub struct CelestialBody {
    pub id: PlanetId,
    pub name: String,
    pub orbit: Option<Orbit>,
    pub color: Color,
    pub children: Vec<PlanetId>,
    pub rotational_period: usize,
    pub temperature: i32,
}

A celestial body.

Fields

id: PlanetId

The id of the body.

name: String

The name of the body.

orbit: Option<Orbit>

The orbit of the body.

color: Color

The color of the body.

children: Vec<PlanetId>

The ids of the planets in orbit of this one.

rotational_period: usize

The number of seconds the planet takes to rotate.

temperature: i32

The temperature in degrees kelvin.

Implementations

impl CelestialBody[src]

pub fn new(
    name: String,
    temperature: i32,
    rotational_period: usize,
    color: Color
) -> Self
[src]

Creates a new CelestialBody.

pub fn is_luminous(&self) -> bool[src]

Calculates whether a planet is luminous.

https://qph.fs.quoracdn.net/main-qimg-6bce97c94fb60cc1fe025591653de493

pub fn with_moon(
    &mut self,
    moon: &mut CelestialBody,
    period: usize
) -> &mut Self
[src]

Adds a new moon to this planet.

pub fn with_parent(
    &mut self,
    parent: &mut CelestialBody,
    period: usize
) -> &mut Self
[src]

Sets the parent of this planet.

pub fn validate_calendar(
    &self,
    calendar: &Calendar
) -> Result<bool, ValidationError>
[src]

Validates an orbit against a calendar, ensuring the rotational and orbital periods are correct.

Trait Implementations

impl Clone for CelestialBody[src]

impl Debug for CelestialBody[src]

impl<'de> Deserialize<'de> for CelestialBody[src]

impl Serialize for CelestialBody[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,