microcad_core/bounds.rs
1// Copyright © 2025 The µcad authors <info@ucad.xyz>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4//! Generic bounds.
5
6/// Bounds.
7#[derive(Debug, Clone)]
8pub struct Bounds<T> {
9 /// Minimum corner.
10 pub min: T,
11 /// Maximum corner.
12 pub max: T,
13}
14
15impl<T> Bounds<T> {
16 /// Create new bounds (unvalidated).
17 pub fn new(min: T, max: T) -> Self {
18 Self { min, max }
19 }
20
21 /// Minimum and maximum corner.
22 pub fn min_max(&self) -> (&T, &T) {
23 (&self.min, &self.max)
24 }
25}