Skip to main content

Crate use_material_property

Crate use_material_property 

Source
Expand description

Lightweight material-property metadata helpers.

This crate intentionally stays small. It models a property kind, a numeric value, and a display unit without becoming a full material database.

§Examples

use use_material_property::{
    MaterialProperty, MaterialPropertyKind, filter_by_kind, property_values,
};

let properties = [
    MaterialProperty::new(MaterialPropertyKind::Density, 7_850.0, "kg/m^3").unwrap(),
    MaterialProperty::new(MaterialPropertyKind::Stress, 250_000_000.0, "Pa").unwrap(),
    MaterialProperty::new(MaterialPropertyKind::Density, 1_000.0, "kg/m^3").unwrap(),
];

assert_eq!(filter_by_kind(&properties, MaterialPropertyKind::Density).len(), 2);
assert_eq!(property_values(&properties, MaterialPropertyKind::Density), vec![7_850.0, 1_000.0]);

Structs§

MaterialProperty

Enums§

MaterialPropertyError
MaterialPropertyKind

Functions§

filter_by_kind
property_values