omf/
lib.rs

1//! Reader and writer for Open Mining Format version 2,
2//! a standard for mining data interchange backed by the
3//! [Global Mining Guidelines Group](https://gmggroup.org).
4//!
5//! > **Warning:**
6//! > This is a beta release of OMF 2. The storage format and libraries might be changed in
7//! > backward-incompatible ways and are not subject to any SLA or deprecation policy.
8//! > Further, this code is unfinished and may not be secure.
9//! > Don't use it to open files you don't trust, and don't use it in production yet.
10//!
11//! # What is OMF
12//!
13//! OMF is an open-source serialization format and library to support data interchange
14//! across the entire mining community.
15//! Its goal is to standardize file formats and promote collaboration.
16//!
17//! This repository provides a file format specification and a Rust library for reading and writing files,
18//! plus wrappers to use that library from C and Python.
19//!
20//! # Getting Started
21//!
22//! The [Reader](crate::file::Reader) and [Writer](crate::file::Writer)
23//! objects are the starting points for reading and writing files.
24//! [Error](crate::error::Error) is the combined error type for everything.
25//! [Project] is the root object of the data contained within the file,
26//! storing a list of [elements](crate::Element),
27//! each containing some [geometry](crate::Geometry) and a list of [attributes](crate::Attribute).
28//!
29//! Supported element geometries are:
30//!
31//! - [Points](crate::PointSet).
32//! - [Line segments](crate::LineSet).
33//! - [Triangulated surfaces](crate::Surface).
34//! - [Grid surfaces](crate::GridSurface).
35//!     - Regular or tensor [grid spacing](crate::Grid2).
36//!     - Any [orientation](crate::Orient2).
37//! - [Block models](crate::BlockModel), with optional [sub-blocks](crate::Subblocks).
38//!     - Regular or tensor [grid spacing](crate::Grid3).
39//!     - Any [orientation](crate::Orient3).
40//!     - Regular sub-blocks that lie on a grid within their parent, with octree or arbitrary layout.
41//!     - Free-form sub-blocks that don't lie on any grid.
42//! - [Composite] elements made out of any of the above.
43//!
44//! Supported attribute data types are:
45//!
46//! - [Floating-point or signed integer](crate::AttributeData::Number) values,
47//!   including date and date-time values.
48//! - [Category](crate::AttributeData::Category) values,
49//!   storing an index used to look up name, color, or other sub-attributes.
50//! - [Boolean](crate::AttributeData::Boolean) or filter values.
51//! - 2D and 3D [vector](crate::AttributeData::Vector) values.
52//! - [Text](crate::AttributeData::Text) values.
53//! - [Color](crate::AttributeData::Color) values.
54//! - [Projected texture](crate::AttributeData::ProjectedTexture) images.
55//! - [UV mapped texture](crate::AttributeData::MappedTexture) images.
56//!
57//! Attributes values can be valid or null.
58//! They can be attached to different [parts](crate::Location) of each element type,
59//! such as the vertices vs. faces of a surface,
60//! or the parent blocks vs. sub-blocks of a block model.
61
62#![deny(unsafe_code)]
63
64mod array;
65mod attribute;
66mod block_model;
67mod colormap;
68#[cfg(feature = "parquet")]
69pub mod data;
70pub mod date_time;
71mod element;
72pub mod error;
73pub mod file;
74mod geometry;
75mod grid;
76#[cfg(feature = "omf1")]
77pub mod omf1;
78#[cfg(feature = "parquet")]
79mod pqarray;
80mod project;
81mod schema;
82#[cfg(test)]
83mod schema_doc;
84pub mod validate;
85mod version;
86
87pub use array::{Array, ArrayType, DataType, array_type};
88pub use attribute::{Attribute, AttributeData, Location};
89pub use block_model::{BlockModel, SubblockMode, Subblocks};
90pub use colormap::{NumberColormap, NumberRange};
91pub use element::Element;
92pub use geometry::{Composite, Geometry, GridSurface, LineSet, PointSet, Surface};
93pub use grid::{Grid2, Grid3, Orient2, Orient3};
94pub use project::Project;
95pub use schema::json_schema;
96pub use version::{
97    CRATE_NAME, CRATE_VERSION, FORMAT_EXTENSION, FORMAT_NAME, FORMAT_VERSION_MAJOR,
98    FORMAT_VERSION_MINOR, FORMAT_VERSION_PRERELEASE, crate_full_name, format_full_name,
99    format_version,
100};
101
102/// A 3D vector with `f64` components.
103pub type Vector3 = [f64; 3];
104
105/// RGBA color with components from 0 to 255.
106pub type Color = [u8; 4];