pub trait SpectralTable {
type Value;
// Required method
fn table(&self) -> &[(u32, Self::Value)];
// Provided methods
fn at(&self, wavelength: u32) -> Option<&Self::Value> { ... }
fn is_empty(&self) -> bool { ... }
fn len(&self) -> usize { ... }
fn max_wavelength(&self) -> Option<u32> { ... }
fn min_wavelength(&self) -> Option<u32> { ... }
fn step(&self) -> u32 { ... }
fn values(&self) -> impl Iterator<Item = &Self::Value> + '_ { ... }
fn wavelengths(&self) -> impl Iterator<Item = u32> + '_ { ... }
}Expand description
Common interface for wavelength-indexed spectral data.
All spectral data types (SPD, CMF, chromaticity coordinates, cone fundamentals) implement this trait, providing uniform access to wavelength-value pairs.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn at(&self, wavelength: u32) -> Option<&Self::Value>
fn at(&self, wavelength: u32) -> Option<&Self::Value>
Returns the value at the given wavelength, or None if not present.
Sourcefn max_wavelength(&self) -> Option<u32>
fn max_wavelength(&self) -> Option<u32>
Returns the maximum wavelength in the table, or None if empty.
Sourcefn min_wavelength(&self) -> Option<u32>
fn min_wavelength(&self) -> Option<u32>
Returns the minimum wavelength in the table, or None if empty.
Sourcefn values(&self) -> impl Iterator<Item = &Self::Value> + '_
fn values(&self) -> impl Iterator<Item = &Self::Value> + '_
Returns an iterator over the values (without wavelengths).
Sourcefn wavelengths(&self) -> impl Iterator<Item = u32> + '_
fn wavelengths(&self) -> impl Iterator<Item = u32> + '_
Returns an iterator over the wavelengths (without values).
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.