Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions metatomic-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use crate::c_api::mta_status_t;

pub use self::metadata::{ModelMetadata, PairListOptions};

mod quantities;
pub use self::quantities::{Quantity, SampleKind, Gradients};
mod quantity;
pub use self::quantity::{Quantity, SampleKind, Gradients, check_quantities};

mod system;
pub use self::system::System;
Expand Down
11 changes: 11 additions & 0 deletions metatomic-core/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::collections::BTreeMap;

use json::JsonValue;

use crate::metadata::DType::Float32;
use crate::{Error, Quantity};
use crate::units::validate_unit;

Expand Down Expand Up @@ -470,6 +471,16 @@ pub enum DType {
Float64,
}

impl std::fmt::Display for DType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if *self == Float32 {
write!(f, "float32")
} else {
write!(f, "float64")
}
}
}

impl From<DType> for JsonValue {
fn from(value: DType) -> Self {
match value {
Expand Down
Loading
Loading