[−][src]Struct rustc_mir_build::thir::pattern::usefulness::SpanSet
Represents a set of Spans closed under the containment relation. That is, if a Span is
contained in the set then all Spans contained in it are also implicitly contained in the set.
In particular this means that when intersecting two sets, taking the intersection of some span
and one of its subspans returns the subspan, whereas a simple HashSet would have returned an
empty intersection.
It is assumed that two spans don't overlap without one being contained in the other; in other
words, that the inclusion structure forms a tree and not a DAG.
Intersection is not very efficient. It compares everything pairwise. If needed it could be made
faster by sorting the Spans and merging cleverly.
Fields
root_spans: Vec<Span>The minimal set of Spans required to represent the whole set. If A and B are Spans in
the SpanSet, and A is a descendant of B, then only B will be in root_spans.
Invariant: the spans are disjoint.
Implementations
impl SpanSet[src]
fn new() -> Self[src]
Creates an empty set.
pub(crate) fn is_empty(&self) -> bool[src]
Tests whether the set is empty.
pub(crate) fn iter<'a>(&'a self) -> impl Iterator<Item = Span> + Captures<'a>[src]
Iterate over the disjoint list of spans at the roots of this set.
fn contains(&self, span: Span) -> bool[src]
Tests whether the set contains a given Span.
fn push_nonintersecting(&mut self, new_span: Span)[src]
Add a span to the set if we know the span has no intersection in this set.
fn intersection_mut(&mut self, other: &Self)[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for SpanSet[src]
impl !Send for SpanSet[src]
impl !Sync for SpanSet[src]
impl Unpin for SpanSet[src]
impl UnwindSafe for SpanSet[src]
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,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
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.
pub fn to_owned(&self) -> T[src]
pub 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.
pub 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>,