tessarikv 0.1.0

A pure-Rust, lock-free-first LSM key-value storage engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! The one range check every option goes through.

use crate::{Error, Result};

/// Refuses `value` unless `min <= value <= max`, naming the option by its field path.
pub(super) fn check_range(option: &'static str, value: u64, min: u64, max: u64) -> Result<()> {
    if (min..=max).contains(&value) {
        return Ok(());
    }
    Err(Error::InvalidOptions {
        option,
        reason: format!("{value} is outside {min}..={max}"),
    })
}