metatensor/
lib.rs

1//! # Metatensor
2//!
3//! Metatensor is a library providing a specialized data storage format for
4//! atomistic machine learning (think ``numpy`` or ``torch.Tensor``, but also
5//! carrying extra metadata for atomistic systems).
6//!
7//! The core of the format is implemented in `metatensor-core`, and exported as a
8//! C API. This C API is then re-exported to Rust in this crate. By default,
9//! metatensor-core is distributed as a shared library that you'll need to
10//! install separately on end user machines.
11//!
12//! ## Features
13//!
14//! You can enable the `static` feature in Cargo.toml to use a static build of
15//! the C API, removing the need to carry around the metatensor-core shared
16//! library.
17//!
18//! ```toml
19//! [dependencies]
20//! metatensor = {version = "...", features = ["static"]}
21//! ```
22
23#![warn(clippy::all, clippy::pedantic)]
24
25// disable some style lints
26#![allow(clippy::needless_return, clippy::must_use_candidate, clippy::comparison_chain)]
27#![allow(clippy::redundant_field_names, clippy::redundant_closure_for_method_calls, clippy::redundant_else)]
28#![allow(clippy::unreadable_literal, clippy::option_if_let_else, clippy::module_name_repetitions)]
29#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::missing_safety_doc)]
30#![allow(clippy::similar_names, clippy::borrow_as_ptr, clippy::uninlined_format_args)]
31#![allow(clippy::missing_const_for_thread_local)]
32
33pub use metatensor_sys as c_api;
34
35pub mod errors;
36pub use self::errors::Error;
37
38mod data;
39pub use self::data::{ArrayRef, ArrayRefMut};
40pub use self::data::{Array, EmptyArray};
41
42mod labels;
43pub use self::labels::{Labels, LabelsBuilder, LabelValue};
44pub use self::labels::{LabelsIter, LabelsFixedSizeIter};
45
46#[cfg(feature = "rayon")]
47pub use self::labels::LabelsParIter;
48
49mod block;
50pub use self::block::{TensorBlock, TensorBlockRef, TensorBlockRefMut};
51pub use self::block::{TensorBlockData, TensorBlockDataMut};
52pub use self::block::{GradientsIter, GradientsMutIter};
53pub use self::block::LazyMetadata;
54
55mod tensor;
56pub use self::tensor::TensorMap;
57pub use self::tensor::{TensorMapIter, TensorMapIterMut};
58#[cfg(feature = "rayon")]
59pub use self::tensor::{TensorMapParIter, TensorMapParIterMut};
60
61pub mod io;