SpaceTemporalInterval

Trait SpaceTemporalInterval 

Source
pub trait SpaceTemporalInterval {
    // Required methods
    fn time(&self) -> f64;
    fn position(&self) -> [f64; 3];

    // Provided method
    fn interval_squared(&self, other: &Self) -> f64 { ... }
}
Expand description

Trait for spacetime types that support Minkowski-style interval calculations.

This trait enables causal reasoning in spacetime-aware systems using the Minkowski metric from special relativity:

s² = -c²·Δt² + Δx² + Δy² + Δz²

This interval:

  • Is negative for time-like separations (causally connected)
  • Is zero for light-like (null) paths (on the light cone)
  • Is positive for space-like separations (no causal connection)

The default implementation assumes:

  • Time is in seconds
  • Space is in meters
  • Speed of light c = 299_792_458 m/s

§Required Methods

  • time(): Returns the scalar time coordinate in seconds
  • position(): Returns the spatial coordinates [x, y, z] in meters

§Default Method

  • interval_squared(&self, &Self) -> f64: Computes the squared interval between two events

Required Methods§

Source

fn time(&self) -> f64

Returns the time coordinate in seconds.

Source

fn position(&self) -> [f64; 3]

Returns the spatial coordinates [x, y, z] in meters.

Provided Methods§

Source

fn interval_squared(&self, other: &Self) -> f64

Computes the squared Minkowski interval between self and other.

s² = -c²·Δt² + Δx² + Δy² + Δz²

where c = 299_792_458 m/s.

Negative indicates time-like separation, zero indicates light-like (null), and positive indicates space-like.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§