Skip to main content

LightContext

Struct LightContext 

Source
pub struct LightContext {
    pub two_grav_param_over_c3: f64,
}
Expand description

Configuration for the Shapiro delay — the extra time light (or radio signals) takes to travel near a massive body because gravity curves spacetime.

In simple terms: when a light beam or radar pulse passes close to a star or planet, general relativity makes the path take a tiny bit longer than it would in flat space. This struct holds the single number that controls how strong that delay is for a particular central body (the Sun, a planet, another star, etc.).

Used in high-precision light-time calculations, spacecraft ranging, pulsar timing, and very-long-baseline interferometry (VLBI).

Fields§

§two_grav_param_over_c3: f64

2GM/c³ in seconds — the characteristic gravitational time scale used in the one-way Shapiro delay formula.

This is mathematically equal to 2 * GM / c³, where:

  • G is Newton’s gravitational constant,
  • M is the mass of the central body,
  • c is the speed of light.

“GM” (often written as a single value called the standard gravitational parameter or μ) is the product of G and M. In real-world astronomy it is measured very accurately as one combined number (in m³/s²), so we keep it together here.

It tells the light-propagation code “how strong the gravitational slowing is” for this body. Bigger value = stronger delay effect.

Most users never set this manually — just use SOLAR or from_grav_param().

Implementations§

Source§

impl LightContext

Source

pub const SOLAR: Self

Ready-to-use value for our own Sun, based on the exact IAU 2015 recommended constants.

Use this for any typical solar-system light-propagation calculation (radar to planets, spacecraft tracking, etc.).

Source

pub const FLAT: Self

No gravitational delay at all (flat spacetime approximation).

Perfect for:

  • interstellar or intergalactic distances,
  • quick “ignore gravity” calculations,
  • or when you want to apply your own custom gravitational model elsewhere.
Source

pub const fn from_grav_param(grav_param: f64) -> Self

Creates a LightContext for any central body (planet, star, black hole, etc.).

§Arguments
  • grav_param — the body’s standard gravitational parameter (GM or μ) in m³/s². This is the product of Newton’s gravitational constant and the body’s mass.

Trait Implementations§

Source§

impl Clone for LightContext

Source§

fn clone(&self) -> LightContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LightContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for LightContext

Source§

fn eq(&self, other: &LightContext) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for LightContext

Source§

impl StructuralPartialEq for LightContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.