1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # Metatensor
//!
//! Metatensor is a library providing a specialized data storage format for
//! atomistic machine learning (think ``numpy`` or ``torch.Tensor``, but also
//! carrying extra metadata for atomistic systems).
//!
//! The core of the format is implemented in `metatensor-core`, and exported as a
//! C API. This C API is then re-exported to Rust in this crate. By default,
//! metatensor-core is distributed as a shared library that you'll need to
//! install separately on end user machines.
//!
//! ## Features
//!
//! You can enable the `static` feature in Cargo.toml to use a static build of
//! the C API, removing the need to carry around the metatensor-core shared
//! library.
//!
//! ```toml
//! [dependencies]
//! metatensor = {version = "...", features = ["static"]}
//! ```

#![warn(clippy::all, clippy::pedantic)]

// disable some style lints
#![allow(clippy::needless_return, clippy::must_use_candidate, clippy::comparison_chain)]
#![allow(clippy::redundant_field_names, clippy::redundant_closure_for_method_calls, clippy::redundant_else)]
#![allow(clippy::unreadable_literal, clippy::option_if_let_else, clippy::module_name_repetitions)]
#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::missing_safety_doc)]
#![allow(clippy::similar_names, clippy::borrow_as_ptr, clippy::uninlined_format_args)]

pub mod c_api;

pub mod errors;
pub use self::errors::Error;

mod data;
pub use self::data::{ArrayRef, ArrayRefMut};
pub use self::data::{Array, EmptyArray};

mod labels;
pub use self::labels::{Labels, LabelsBuilder, LabelValue};
pub use self::labels::{LabelsIter, LabelsFixedSizeIter};

#[cfg(feature = "rayon")]
pub use self::labels::LabelsParIter;

mod block;
pub use self::block::{TensorBlock, TensorBlockRef, TensorBlockRefMut};
pub use self::block::{GradientsIter, GradientsMutIter};
pub use self::block::LazyMetadata;

mod tensor;
pub use self::tensor::TensorMap;
pub use self::tensor::{TensorMapIter, TensorMapIterMut};
#[cfg(feature = "rayon")]
pub use self::tensor::{TensorMapParIter, TensorMapParIterMut};

pub mod io;


/// Path where the metatensor shared library has been built
pub fn c_api_install_dir() -> &'static str {
    return env!("OUT_DIR");
}