pub struct OverlappingElement<'a, R, S, T> where
R: RangeBounds<T> + 'a,
S: RangeBounds<T> + 'a,
T: Ord + 'a, {
pub value: &'a R,
/* private fields */
}
Expand description
An element contained within an Overlapping
.
This element allows access to its contained value I
and its sub-elements which also overlap
with the query S
.
An OverlappingElement
is usually obtained from iterating over an Overlapping
.
Example
use nested_containment_list::NestedContainmentList;
use std::iter::FromIterator;
let nclist = NestedContainmentList::from_iter(vec![1..4, 2..3]);
let query = 2..4;
let mut overlapping = nclist.overlapping(&query);
let overlapping_element = overlapping.next().unwrap();
assert_eq!(overlapping_element.value, &(1..4));
let inner_overlapping_element = overlapping_element.sublist().next().unwrap();
assert_eq!(inner_overlapping_element.value, &(2..3));
Fields
value: &'a R
Implementations
sourceimpl<'a, R, S, T> OverlappingElement<'a, R, S, T> where
R: RangeBounds<T>,
S: RangeBounds<T>,
T: Ord,
impl<'a, R, S, T> OverlappingElement<'a, R, S, T> where
R: RangeBounds<T>,
S: RangeBounds<T>,
T: Ord,
sourcepub fn sublist(&self) -> Overlapping<'a, R, S, T>ⓘNotable traits for Overlapping<'a, R, S, T>impl<'a, R, S, T> Iterator for Overlapping<'a, R, S, T> where
R: RangeBounds<T>,
S: RangeBounds<T>,
T: Ord, type Item = OverlappingElement<'a, R, S, T>;
pub fn sublist(&self) -> Overlapping<'a, R, S, T>ⓘNotable traits for Overlapping<'a, R, S, T>impl<'a, R, S, T> Iterator for Overlapping<'a, R, S, T> where
R: RangeBounds<T>,
S: RangeBounds<T>,
T: Ord, type Item = OverlappingElement<'a, R, S, T>;
R: RangeBounds<T>,
S: RangeBounds<T>,
T: Ord, type Item = OverlappingElement<'a, R, S, T>;
Return an Overlapping
Iterator
over this element’s contained sublist.
Example
use nested_containment_list::NestedContainmentList;
use std::iter::FromIterator;
let nclist = NestedContainmentList::from_iter(vec![1..5, 2..3, 3..4]);
let query = 2..4;
let mut overlapping = nclist.overlapping(&query);
let overlapping_element = overlapping.next().unwrap();
assert_eq!(overlapping_element.value, &(1..5));
let mut inner_overlapping = overlapping_element.sublist();
assert_eq!(inner_overlapping.next().unwrap().value, &(2..3));
assert_eq!(inner_overlapping.next().unwrap().value, &(3..4));
Trait Implementations
sourceimpl<'a, R: Debug, S: Debug, T: Debug> Debug for OverlappingElement<'a, R, S, T> where
R: RangeBounds<T> + 'a,
S: RangeBounds<T> + 'a,
T: Ord + 'a,
impl<'a, R: Debug, S: Debug, T: Debug> Debug for OverlappingElement<'a, R, S, T> where
R: RangeBounds<T> + 'a,
S: RangeBounds<T> + 'a,
T: Ord + 'a,
sourceimpl<'a, R, S, T> IntoIterator for OverlappingElement<'a, R, S, T> where
R: RangeBounds<T>,
S: RangeBounds<T>,
T: Ord,
impl<'a, R, S, T> IntoIterator for OverlappingElement<'a, R, S, T> where
R: RangeBounds<T>,
S: RangeBounds<T>,
T: Ord,
sourcefn into_iter(self) -> Self::IntoIter
fn into_iter(self) -> Self::IntoIter
Returns an Iterator
over this element’s value
, followed by its sublist()
elements
that overlap with the query S
.
This is useful if you want to iterate over all values including the enclosing value.
Example
use nested_containment_list::NestedContainmentList;
use std::iter::FromIterator;
let nclist = NestedContainmentList::from_iter(vec![1..4, 2..3]);
let mut overlapping = nclist.overlapping(&(2..5));
let first_element = overlapping.next().unwrap();
let mut first_element_iter = first_element.into_iter();
assert_eq!(first_element_iter.next().unwrap().value, &(1..4));
assert_eq!(first_element_iter.next().unwrap().value, &(2..3));
type Item = Self
type Item = Self
The type of the elements being iterated over.
type IntoIter = Chain<Once<Self::Item>, Overlapping<'a, R, S, T>>
type IntoIter = Chain<Once<Self::Item>, Overlapping<'a, R, S, T>>
Which kind of iterator are we turning this into?
Auto Trait Implementations
impl<'a, R, S, T> RefUnwindSafe for OverlappingElement<'a, R, S, T> where
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, R, S, T> Send for OverlappingElement<'a, R, S, T> where
R: Sync,
S: Sync,
T: Send + Sync,
impl<'a, R, S, T> Sync for OverlappingElement<'a, R, S, T> where
R: Sync,
S: Sync,
T: Sync,
impl<'a, R, S, T> Unpin for OverlappingElement<'a, R, S, T> where
T: Unpin,
impl<'a, R, S, T> UnwindSafe for OverlappingElement<'a, R, S, T> where
R: RefUnwindSafe,
S: RefUnwindSafe,
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more