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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//! This create provides operations for mathematical intervals.
//! Such intervals include all values between two bounds.
//!
//! This library supports multiple kinds of intervals. Let's call E the
//! set of valid values in the interval,
//!
//! |Interval|Constructor |Description
//! |--------|----------------------------------|--------------
//! | `[A,B]`|[`Interval::new_closed_closed`] |left-closed, right-closed
//! | `[A,B)`|[`Interval::new_closed_open`] |left-closed, right-open
//! | `(A,B)`|[`Interval::new_open_open`] |left-open, right-open
//! | `(A,B]`|[`Interval::new_open_closed`] |left-open, right-closed
//! | `(,B]` |[`Interval::new_unbounded_closed`]|left-unbounded, right-closed
//! | `(,B)` |[`Interval::new_unbounded_open`] |left-unbounded, right-open
//! | `[A,)` |[`Interval::new_closed_unbounded`]|left-closed, right-unbounded
//! | `(A,)` |[`Interval::new_open_unbounded`] |left-open, right-unbounded
//! | `(,)` |[`Interval::doubly_unbounded`] |doubly unbounded
//! | `empty`|[`Interval::default()`] |empty
//!
//! Any type can be used for the bounds, though operations on the interval
//! depends on the traits that the bound type implements.
//!
//! Intervals on floats (like any code using float) can be tricky. For
//! instance, the two intervals `[1.0, 100.0)` and `[1.0, 100.0 - f32:EPSILON)`
//! are not considered equivalent, since the machine thinks the two upper
//! bounds have the same value, but one of them is closed and the other is
//! open.
//!
//! Although this type is mostly intended to be used when T can be ordered,
//! it is in fact possible to define intervals using any type. But only a few
//! functions are then available (like [`Interval::lower()`],
//! [`Interval::upper()`],...)
//!
//! Given two intervals, and assuming T is orderable, we can compute the
//! following:
//!
//! ```none
//! [------ A ------]
//! [----- B -------]
//!
//! [----------------------] Convex hull
//! [------) Difference (A - B)
//! (------] Difference (B - A)
//! [------) (------] Symmetric difference (A ^ B)
//! [--------] Intersection (A & B)
//! Between is empty
//! [----------------------] Union (A | B)
//! ```
//!
//! When the two intervals do not overlap, we can compute:
//! ```none
//! [---A---] [----B----]
//!
//! [---------------------] Convex hull
//! [-------] Difference (A - B)
//! [---------] Difference (B - A)
//! [-------] [---------] Symmetric difference (A ^ B)
//! Intersection (A & B) is empty
//! (---) Between
//! Union (A | B) is empty, non contiguous
//! ```
//!
pub use crate;
pub use crateIntervalIterator;
pub use crateNothingBetween;
pub use cratePair;
pub use crate;
pub use crateIntervalSet;
pub use crateJoining;
pub use crateSeparating;
/// This macro lets you create intervals with a syntax closer to what Postgresql
/// provides.
/// There are multiple variants of this macro:
///
/// - `interval!(a, b)` and `interval!(a, b, "[)")`:
/// Creates a closed-open interval `[a,b)`
/// - `interval!(a, b, "[]")`:
/// Creates a closed-closed interval `[a,b]`
/// - `interval!(a, b, "()")`:
/// Creates an open-open interval `(a,b)`
/// - `interval!(a, b, "(]")`:
/// Creates an open-closed interval `(a,b]`
/// - `interval!(a, "inf")` or `interval!(a, "[inf]")`:
/// Creates a closed-unbounded interval `[a,)`
/// - `interval!(a, "(inf")`:
/// Creates an open-unbounded interval `(a,)`
/// - `interval!("-inf", b)` or `interval!("-inf", b, ")")`:
/// Creates an unbounded-open interval `(,b)`
/// - `interval!("-inf", b, "]")`:
/// Creates an unbounded-closed interval `(,b]`
///
;
=> ;
=> ;
=> ;
=> ;
=> ;
}