pub struct MaterialComparison {
pub axes: Vec<String>,
}Expand description
Compare materials using performance indices and radar chart data.
Fields§
§axes: Vec<String>Property keys used for comparison.
Implementations§
Source§impl MaterialComparison
impl MaterialComparison
Sourcepub fn new(axes: Vec<String>) -> Self
pub fn new(axes: Vec<String>) -> Self
Create a MaterialComparison for the given set of property axes.
Sourcepub fn performance_index(
&self,
record: &MaterialRecord,
numerator: &str,
denominator: &str,
) -> Option<f64>
pub fn performance_index( &self, record: &MaterialRecord, numerator: &str, denominator: &str, ) -> Option<f64>
Compute a performance index for a record.
The index is the ratio of two properties: numerator / denominator.
Returns None if either property is missing or denominator is zero.
Sourcepub fn rank_by_index<'a>(
&self,
records: &[&'a MaterialRecord],
numerator: &str,
denominator: &str,
) -> Vec<(&'a MaterialRecord, f64)>
pub fn rank_by_index<'a>( &self, records: &[&'a MaterialRecord], numerator: &str, denominator: &str, ) -> Vec<(&'a MaterialRecord, f64)>
Rank materials by performance index (descending, highest first).
Sourcepub fn radar_data(
&self,
record: &MaterialRecord,
reference_values: &[f64],
) -> Vec<f64>
pub fn radar_data( &self, record: &MaterialRecord, reference_values: &[f64], ) -> Vec<f64>
Produce radar chart data for a single material: normalized values on each axis.
Each value is divided by reference_values[i] for normalization.
Trait Implementations§
Source§impl Clone for MaterialComparison
impl Clone for MaterialComparison
Source§fn clone(&self) -> MaterialComparison
fn clone(&self) -> MaterialComparison
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MaterialComparison
impl RefUnwindSafe for MaterialComparison
impl Send for MaterialComparison
impl Sync for MaterialComparison
impl Unpin for MaterialComparison
impl UnsafeUnpin for MaterialComparison
impl UnwindSafe for MaterialComparison
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.