pub struct IntervalsSingle<E, V> { /* private fields */ }Expand description
Implementations§
Source§impl<E, V> IntervalsSingle<E, V>
impl<E, V> IntervalsSingle<E, V>
Sourcepub fn new(v: Interval<E, V>) -> Self
pub fn new(v: Interval<E, V>) -> Self
Wrap a single Interval.
Examples found in repository?
More examples
examples/union.rs (line 16)
10fn main() {
11 // [1, 3] tagged "A"
12 let ia = Interval::new(EndpointOC::Closed(1), EndpointOC::Closed(3), "A");
13 // (2, 4) tagged "B"
14 let ib = Interval::new(EndpointOC::Open(2), EndpointOC::Open(4), "B");
15
16 let isa = IntervalsSingle::new(ia);
17 let isb = IntervalsSingle::new(ib);
18
19 // Union: [1,2] -> (Some("A"), None), (2,3] -> (Some("A"), Some("B")), (3,4) -> (None, Some("B"))
20 for iv in or(isa, isb).into_iter() {
21 println!("{:?}", iv);
22 }
23}examples/intersection.rs (line 13)
7fn main() {
8 // [1, 3] tagged "A"
9 let ia = Interval::new(EndpointOC::Closed(1), EndpointOC::Closed(3), "A");
10 // (2, 4) tagged "B"
11 let ib = Interval::new(EndpointOC::Open(2), EndpointOC::Open(4), "B");
12
13 let isa = IntervalsSingle::new(ia);
14 let isb = IntervalsSingle::new(ib);
15
16 // Intersection: (2, 3] tagged ("A", "B")
17 let result = and(isa, isb).into_iter().collect::<Vec<_>>();
18
19 for iv in &result {
20 println!("{:?}", iv);
21 }
22
23 assert_eq!(result.len(), 1);
24 assert_eq!(
25 result[0],
26 Interval::new(EndpointOC::Open(2), EndpointOC::Closed(3), ("A", "B"))
27 );
28}Trait Implementations§
Source§impl<T, V, Ic> BitAnd<Ic> for IntervalsSingle<T, V>
Available on crate feature operators only.
impl<T, V, Ic> BitAnd<Ic> for IntervalsSingle<T, V>
Available on crate feature
operators only.Source§type Output = IntervalsWrap<IntervalsAnd<IntervalsSingle<T, V>, Ic>>
type Output = IntervalsWrap<IntervalsAnd<IntervalsSingle<T, V>, Ic>>
The resulting type after applying the
& operator.Source§impl<T, V, Ic> BitOr<Ic> for IntervalsSingle<T, V>
Available on crate feature operators only.
impl<T, V, Ic> BitOr<Ic> for IntervalsSingle<T, V>
Available on crate feature
operators only.Source§type Output = IntervalsWrap<IntervalsOr<IntervalsSingle<T, V>, Ic>>
type Output = IntervalsWrap<IntervalsOr<IntervalsSingle<T, V>, Ic>>
The resulting type after applying the
| operator.Source§impl<E, V> Intervals for IntervalsSingle<E, V>
impl<E, V> Intervals for IntervalsSingle<E, V>
Source§type Endpoint = E
type Endpoint = E
The endpoint flavor — typically
EndpointOC or
EndpointSymmetric.Auto Trait Implementations§
impl<E, V> Freeze for IntervalsSingle<E, V>
impl<E, V> RefUnwindSafe for IntervalsSingle<E, V>where
V: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, V> Send for IntervalsSingle<E, V>
impl<E, V> Sync for IntervalsSingle<E, V>
impl<E, V> Unpin for IntervalsSingle<E, V>
impl<E, V> UnsafeUnpin for IntervalsSingle<E, V>where
V: UnsafeUnpin,
E: UnsafeUnpin,
impl<E, V> UnwindSafe for IntervalsSingle<E, V>where
V: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more