starfall/astronomy/distant_binary_star/
mod.rs1use crate::astronomy::planetary_system::PlanetarySystem;
2
3pub mod constants;
4pub mod constraints;
5pub mod error;
6use error::Error;
7
8#[derive(Clone, Debug, PartialEq)]
20pub struct DistantBinaryStar {
21 pub primary: PlanetarySystem,
23 pub secondary: PlanetarySystem,
25}
26
27impl DistantBinaryStar {
28 #[named]
30 pub fn check_habitable(&self) -> Result<(), Error> {
31 trace_enter!();
32 self.primary.check_habitable()?;
33 self.secondary.check_habitable()?;
34 let result = Ok(());
35 trace_var!(result);
36 trace_exit!();
37 result
38 }
39
40 #[named]
42 pub fn is_habitable(&self) -> bool {
43 trace_enter!();
44 let result = match self.check_habitable() {
45 Ok(()) => true,
46 Err(_) => false,
47 };
48 trace_var!(result);
49 trace_exit!();
50 result
51 }
52
53 #[named]
57 pub fn get_stellar_mass(&self) -> f64 {
58 trace_enter!();
59 let result = self.primary.get_stellar_mass() + self.secondary.get_stellar_mass();
60 trace_var!(result);
61 trace_exit!();
62 result
63 }
64
65 #[named]
67 pub fn get_stellar_count(&self) -> u8 {
68 trace_enter!();
69 let result = self.primary.get_stellar_count() + self.secondary.get_stellar_count();
70 trace_var!(result);
71 trace_exit!();
72 result
73 }
74}