[−][src]Struct holding_solar::CelestialBody
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]
name: String,
temperature: i32,
rotational_period: usize,
color: Color
) -> Self
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]
&mut self,
moon: &mut CelestialBody,
period: usize
) -> &mut Self
Adds a new moon to this planet.
pub fn with_parent(
&mut self,
parent: &mut CelestialBody,
period: usize
) -> &mut Self
[src]
&mut self,
parent: &mut CelestialBody,
period: usize
) -> &mut Self
Sets the parent of this planet.
pub fn validate_calendar(
&self,
calendar: &Calendar
) -> Result<bool, ValidationError>
[src]
&self,
calendar: &Calendar
) -> Result<bool, ValidationError>
Validates an orbit against a calendar, ensuring the rotational and orbital periods are correct.
Trait Implementations
impl Clone for CelestialBody
[src]
fn clone(&self) -> CelestialBody
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CelestialBody
[src]
impl<'de> Deserialize<'de> for CelestialBody
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for CelestialBody
[src]
Auto Trait Implementations
impl RefUnwindSafe for CelestialBody
impl Send for CelestialBody
impl Sync for CelestialBody
impl Unpin for CelestialBody
impl UnwindSafe for CelestialBody
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,