pub enum Relation<T: Domain> {
Disjoint {
first: GenericRange<T>,
second: GenericRange<T>,
self_less: bool,
},
Touching {
first: GenericRange<T>,
second: GenericRange<T>,
self_less: bool,
},
Overlapping {
first_disjoint: GenericRange<T>,
second_disjoint: GenericRange<T>,
overlap: GenericRange<T>,
self_less: bool,
overlap_is_singleton: bool,
},
Containing {
first_disjoint: GenericRange<T>,
second_disjoint: GenericRange<T>,
overlap: GenericRange<T>,
self_shorter: bool,
},
Starting {
overlap: GenericRange<T>,
disjoint: GenericRange<T>,
self_shorter: bool,
shorter_is_singleton: bool,
},
Ending {
disjoint: GenericRange<T>,
overlap: GenericRange<T>,
self_shorter: bool,
shorter_is_singleton: bool,
},
Equal(GenericRange<T>),
Empty {
non_empty: Option<GenericRange<T>>,
self_empty: Option<bool>,
},
}
Expand description
This enum represents all possible arrangements of two GenericRange
s.
The original values were moved, possibly modified, and then stored.
§Note
The following information is additionally contained if applicable:
- which of the two ranges was
self
andother
- if the overlap is a singleton
- if
start
orother
is a singleton - which of
self
andother
is shorter
This information is the result of the comparison of the starts and ends of both ranges and is
obtained “for free” and should thus be used preferably to other methods like
GenericRange::is_singleton()
.
Variants§
Disjoint
Fields
first: GenericRange<T>
The end of this range is less than the start of second
.
second: GenericRange<T>
The start of this range is greater than the end of first
.
Touching
The two ranges have no overlap but the end of the first touches the start of the second.
§Diagram
first : |----------|
second: |----------|
Fields
first: GenericRange<T>
The end of this range touches the start of second
.
second: GenericRange<T>
The start of this range touches the end of first
.
Overlapping
The two ranges have an overlap of one or more elements.
§Diagram
first : |----------|
second : |----------|
first disjoint : |-------|
second disjoint: |-------|
overlap : |--|
Fields
first_disjoint: GenericRange<T>
Range representing the disjoint part of two ranges before the overlap.
second_disjoint: GenericRange<T>
Range representing the disjoint part of two ranges after the overlap.
overlap: GenericRange<T>
Range representing the overlapping part of two ranges.
Containing
One range is contained in the other.
§Diagram
first : |--------------------|
second : |----------|
first disjoint : |----|
second disjoint: |----|
overlap : |----------|
Fields
first_disjoint: GenericRange<T>
Range representing the disjoint part of two ranges before the overlap.
second_disjoint: GenericRange<T>
Range representing the disjoint part of two ranges after the overlap.
overlap: GenericRange<T>
Range representing the overlapping part of two ranges.
Starting
Both ranges have the same start but varying endings.
§Diagram
first : |-----|
second : |----------|
overlap : |-----|
disjoint: |----|
Fields
overlap: GenericRange<T>
Range representing the overlapping part of two ranges.
disjoint: GenericRange<T>
Range representing the disjoint part of two ranges.
Ending
Both ranges have the same end but varying starts.
§Diagram
first : |----------|
second : |----|
disjoint: |-----|
overlap : |----|
Fields
disjoint: GenericRange<T>
Range representing the disjoint part of two ranges.
overlap: GenericRange<T>
Range representing the overlapping part of two ranges.
Equal(GenericRange<T>)
The starts and ends of both ranges are equal.
§Diagram
first : |----------|
second: |----------|
equal : |----------|
Empty
One or both ranges are empty and can therefore not be compared.
§Diagram
first :
second : |----|
non_empty: |----|