pub struct MaterialDatabase { /* private fields */ }Expand description
A database of materials with built-in common engineering materials.
Implementations§
Source§impl MaterialDatabase
impl MaterialDatabase
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
Create a database pre-loaded with common engineering materials.
Sourcepub fn add_material(&mut self, material: Material)
pub fn add_material(&mut self, material: Material)
Add a material to the database.
Sourcepub fn get_material(&self, name: &str) -> Option<&Material>
pub fn get_material(&self, name: &str) -> Option<&Material>
Get a material by name.
Sourcepub fn remove_material(&mut self, name: &str) -> bool
pub fn remove_material(&mut self, name: &str) -> bool
Remove a material.
Sourcepub fn material_count(&self) -> usize
pub fn material_count(&self) -> usize
Number of materials in the database.
Sourcepub fn material_names(&self) -> Vec<String>
pub fn material_names(&self) -> Vec<String>
List all material names.
Sourcepub fn find_by_category(&self, category: MaterialCategory) -> Vec<&Material>
pub fn find_by_category(&self, category: MaterialCategory) -> Vec<&Material>
Find materials by category.
Sourcepub fn find_by_property_range(
&self,
property: PropertyId,
min_value: f64,
max_value: f64,
) -> Vec<&Material>
pub fn find_by_property_range( &self, property: PropertyId, min_value: f64, max_value: f64, ) -> Vec<&Material>
Find materials that have a given property within a range.
Sourcepub fn compare_property(&self, property: PropertyId) -> Vec<(String, f64)>
pub fn compare_property(&self, property: PropertyId) -> Vec<(String, f64)>
Compare a property across all materials.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MaterialDatabase
impl RefUnwindSafe for MaterialDatabase
impl Send for MaterialDatabase
impl Sync for MaterialDatabase
impl Unpin for MaterialDatabase
impl UnsafeUnpin for MaterialDatabase
impl UnwindSafe for MaterialDatabase
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more