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 secondsposition(): 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§
Provided Methods§
Sourcefn interval_squared(&self, other: &Self) -> f64
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 s² 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.