pub struct MaterialsLibrary {
pub site_version: String,
pub entries: Vec<CompendiumEntry>,
/* private fields */
}Expand description
The full parsed compendium with fast lookups.
Fields§
§site_version: StringDataset version tag (top-level siteVersion, e.g. "0.1.1").
entries: Vec<CompendiumEntry>All material entries in file order.
Implementations§
Source§impl MaterialsLibrary
impl MaterialsLibrary
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
Read and parse a compendium JSON file.
Sourcepub fn get(&self, name: &str) -> Option<&CompendiumEntry>
pub fn get(&self, name: &str) -> Option<&CompendiumEntry>
Case-insensitive lookup by display name (“Air (dry, near sea level)”).
Sourcepub fn get_by_matnum(&self, num: u32) -> Option<&CompendiumEntry>
pub fn get_by_matnum(&self, num: u32) -> Option<&CompendiumEntry>
Lookup by compendium material number (1..=411).
Trait Implementations§
Source§impl Clone for MaterialsLibrary
impl Clone for MaterialsLibrary
Source§fn clone(&self) -> MaterialsLibrary
fn clone(&self) -> MaterialsLibrary
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 MaterialsLibrary
impl RefUnwindSafe for MaterialsLibrary
impl Send for MaterialsLibrary
impl Sync for MaterialsLibrary
impl Unpin for MaterialsLibrary
impl UnsafeUnpin for MaterialsLibrary
impl UnwindSafe for MaterialsLibrary
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