1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use num::Num;
pub trait Interval {
type Element: Num + Copy;
fn get_start(&self) -> Self::Element;
fn get_end(&self) -> Self::Element;
fn length(&self) -> Self::Element;
}
pub trait Coalesce<T>: std::marker::Sized {
fn coalesce_with(&self, other: &T) -> Option<Self>;
}
pub trait CoalesceIntervals<I: Interval<Element=E>, E: Num + Copy>: std::marker::Sized {
fn to_coalesced_intervals(&self) -> Vec<I>;
fn coalesce_intervals_inplace(&mut self);
fn into_coalesced(mut self) -> Self {
self.coalesce_intervals_inplace();
self
}
}
pub trait Topology {
fn is_open(&self) -> bool;
fn is_closed(&self) -> bool;
}