pub mod analytic;
pub mod field;
pub mod sounding;
pub mod validate;
pub use field::{ConstantField, ProfileField, ProfileLevel, Wind, WindField};
pub use sounding::{Sounding, SoundingLevel};
pub use validate::{LayerError, ValidationReport};
#[derive(Debug, Clone, PartialEq)]
pub struct Error {
pub field: &'static str,
pub reason: String,
}
impl Error {
pub(crate) fn invalid(field: &'static str, reason: impl Into<String>) -> Self {
Self {
field,
reason: reason.into(),
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}: {}", self.field, self.reason)
}
}
impl std::error::Error for Error {}
pub type Result<T> = std::result::Result<T, Error>;