pub struct Interval<V> { /* private fields */ }Expand description
The two edges of a satisfiable, non-exact VersionRange::Interval.
Invariant: at least one edge is bounded; if both are bounded, lower <= upper and
lower == upper only when both are Included — ordered per the comparator passed to
range_from_edges, the only constructor. A consumer comparing with a different ordering
can still observe lower > upper.
§Examples
Constructing through range_from_edges and reading the edges back:
use deps_core::interval::{VersionRange, range_from_edges};
use std::ops::Bound;
let range = range_from_edges(Bound::Included(1), Bound::Excluded(2), |a: &u32, b: &u32| a.cmp(b));
let Some(VersionRange::Interval(iv)) = range else { unreachable!() };
assert_eq!(iv.lower(), Bound::Included(&1));
assert_eq!(iv.upper(), Bound::Excluded(&2));The fields are private, so an interval cannot be built directly:
ⓘ
use deps_core::interval::Interval;
use std::ops::Bound;
let _ = Interval { lower: Bound::Included(2), upper: Bound::Included(1) };Implementations§
Trait Implementations§
impl<V: Eq> Eq for Interval<V>
impl<V: PartialEq> StructuralPartialEq for Interval<V>
Auto Trait Implementations§
impl<V> Freeze for Interval<V>
impl<V> RefUnwindSafe for Interval<V>where
Bound<V>: RefUnwindSafe,
impl<V> Send for Interval<V>
impl<V> Sync for Interval<V>
impl<V> Unpin for Interval<V>
impl<V> UnsafeUnpin for Interval<V>where
Bound<V>: UnsafeUnpin,
impl<V> UnwindSafe for Interval<V>where
Bound<V>: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.