1use thiserror::Error;
6
7pub trait ReferenceFrame {
8 fn name(&self) -> String;
9 fn abbreviation(&self) -> String;
10 fn is_rotating(&self) -> bool;
11}
12
13pub trait QuasiInertial: ReferenceFrame {}
14
15#[derive(Clone, Debug, Error, Eq, PartialEq)]
16#[error("{0} is not a quasi-inertial frame")]
17pub struct NonQuasiInertialFrameError(pub String);
18
19pub trait TryQuasiInertial: ReferenceFrame {
20 fn try_quasi_inertial(&self) -> Result<(), NonQuasiInertialFrameError>;
21}
22
23impl<T: QuasiInertial> TryQuasiInertial for T {
24 fn try_quasi_inertial(&self) -> Result<(), NonQuasiInertialFrameError> {
25 Ok(())
26 }
27}
28
29pub trait BodyFixed: ReferenceFrame {}
30
31#[derive(Clone, Debug, Error)]
32#[error("{0} is not a body-fixed frame")]
33pub struct NonBodyFixedFrameError(pub String);
34
35pub trait TryBodyFixed: ReferenceFrame {
36 fn try_body_fixed(&self) -> Result<(), NonBodyFixedFrameError>;
37}
38
39impl<T: BodyFixed> TryBodyFixed for T {
40 fn try_body_fixed(&self) -> Result<(), NonBodyFixedFrameError> {
41 Ok(())
42 }
43}