scry-learn 0.1.0

Machine learning toolkit in pure Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Model schema versioning for serde serialization compatibility.

/// Current schema version for serde model serialization.
pub const SCHEMA_VERSION: u32 = 1;

/// Called after deserialization to verify version compatibility.
pub fn check_schema_version(found: u32) -> crate::error::Result<()> {
    if found != SCHEMA_VERSION {
        return Err(crate::error::ScryLearnError::InvalidParameter(format!(
            "model schema version mismatch: expected {SCHEMA_VERSION}, found {found} \
             — model was serialized with an incompatible scry-learn version"
        )));
    }
    Ok(())
}