[−][src]Struct bio::utils::Interval
An Interval
wraps the std::ops::Range
from the stdlib and is defined by a start and end field
where end should be >= start.
Implementations
impl<N: Ord + Clone> Interval<N>
[src]
pub fn new(r: Range<N>) -> Result<Interval<N>, Error>
[src]
Construct a new Interval
from the given Range.
Will return Err
if end < start.
Methods from Deref<Target = Range<N>>
pub fn contains<U>(&self, item: &U) -> bool where
Idx: PartialOrd<U>,
U: PartialOrd<Idx> + ?Sized,
1.35.0[src]
Idx: PartialOrd<U>,
U: PartialOrd<Idx> + ?Sized,
Returns true
if item
is contained in the range.
Examples
assert!(!(3..5).contains(&2)); assert!( (3..5).contains(&3)); assert!( (3..5).contains(&4)); assert!(!(3..5).contains(&5)); assert!(!(3..3).contains(&3)); assert!(!(3..2).contains(&3)); assert!( (0.0..1.0).contains(&0.5)); assert!(!(0.0..1.0).contains(&f32::NAN)); assert!(!(0.0..f32::NAN).contains(&0.5)); assert!(!(f32::NAN..1.0).contains(&0.5));
pub fn is_empty(&self) -> bool
[src]
🔬 This is a nightly-only experimental API. (range_is_empty
)
recently added
Returns true
if the range contains no items.
Examples
#![feature(range_is_empty)] assert!(!(3..5).is_empty()); assert!( (3..3).is_empty()); assert!( (3..2).is_empty());
The range is empty if either side is incomparable:
#![feature(range_is_empty)] assert!(!(3.0..5.0).is_empty()); assert!( (3.0..f32::NAN).is_empty()); assert!( (f32::NAN..5.0).is_empty());
Trait Implementations
impl<N: Clone + Ord> Clone for Interval<N>
[src]
impl<N: Debug + Ord + Clone> Debug for Interval<N>
[src]
impl<N: Ord + Clone> Deref for Interval<N>
[src]
Use the Deref
operator to get a reference to Range
wrapped by the Interval
newtype.
impl<'de, N: Ord + Clone> Deserialize<'de> for Interval<N> where
N: Deserialize<'de>,
[src]
N: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<N: Eq + Ord + Clone> Eq for Interval<N>
[src]
impl<'a, N: Ord + Clone> From<&'a Range<N>> for Interval<N>
[src]
Convert a reference to a Range
to an interval by cloning. This conversion will panic if the
Range
has end < start
impl<N: Ord + Clone> From<Range<N>> for Interval<N>
[src]
Convert a Range
into an Interval
. This conversion will panic if the Range
has end < start
impl<N: PartialEq + Ord + Clone> PartialEq<Interval<N>> for Interval<N>
[src]
impl<N: Ord + Clone> Serialize for Interval<N> where
N: Serialize,
[src]
N: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<N: Ord + Clone> StructuralEq for Interval<N>
[src]
impl<N: Ord + Clone> StructuralPartialEq for Interval<N>
[src]
Auto Trait Implementations
impl<N> RefUnwindSafe for Interval<N> where
N: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for Interval<N> where
N: Send,
N: Send,
impl<N> Sync for Interval<N> where
N: Sync,
N: Sync,
impl<N> Unpin for Interval<N> where
N: Unpin,
N: Unpin,
impl<N> UnwindSafe for Interval<N> where
N: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,