1
0

Update structure of modules

This commit is contained in:
Stefan Müller
2025-12-06 00:59:48 +01:00
parent 0730ce7f01
commit e8a91164d3
6 changed files with 8 additions and 6 deletions
+19
View File
@@ -0,0 +1,19 @@
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone)]
pub struct Interval {
pub start: u64,
pub end: u64,
}
impl Interval {
pub fn new(start: u64, end: u64) -> Interval {
Interval { start, end }
}
pub fn contains(&self, value: u64) -> bool {
self.start <= value && value <= self.end
}
pub fn len(&self) -> u64 {
self.end - self.start + 1
}
}