Skip to main content

rez_next_version/
lib.rs

1//! # Rez Core Version
2//!
3//! Version parsing, comparison, and range handling for Rez Core.
4//!
5//! This crate provides:
6//! - Version parsing and validation
7//! - Version comparison and ordering
8//! - Version range operations
9//! - Token-based version representation
10
11use rez_next_common::RezCoreError;
12
13pub mod parser;
14pub mod range; // Always available for benchmarks and core functionality
15pub mod version;
16
17// Re-export main types
18pub use parser::{StateMachineParser, VersionParser};
19// Always export VersionRange as it's needed by benchmarks and other core functionality
20pub use range::VersionRange;
21pub use version::Version;
22
23// Define a custom error type for version parsing
24#[derive(Debug)]
25pub struct VersionParseError(pub String);
26
27impl std::fmt::Display for VersionParseError {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        write!(f, "Version parse error: {}", self.0)
30    }
31}
32
33impl std::error::Error for VersionParseError {}
34
35impl From<RezCoreError> for VersionParseError {
36    fn from(err: RezCoreError) -> Self {
37        VersionParseError(err.to_string())
38    }
39}
40
41#[cfg(test)]
42mod tests;
43
44#[cfg(test)]
45mod range_tests;