1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
use fehler::throws;
use snafu::ensure;

use crate::errors::{self, Error};

#[derive(Copy, Clone)]
pub struct Bounds {
    pub begin: f64,
    pub end: f64,
}

impl Bounds {
    #[throws]
    pub fn new(begin: f64, end: f64) -> Self {
        ensure!(
            begin <= end,
            errors::BeginBoundGreaterThanEndBound { begin, end }
        );

        Self { begin, end }
    }
}