pub struct Scope<'a, R> { /* private fields */ }
Expand description
An iterator over the parents of a span, ordered from leaf to root.
This is returned by the SpanRef::scope
method.
Implementationsยง
Sourceยงimpl<'a, R> Scope<'a, R>where
R: LookupSpan<'a>,
impl<'a, R> Scope<'a, R>where
R: LookupSpan<'a>,
Sourcepub fn from_root(self) -> ScopeFromRoot<'a, R> โ
Available on crate features alloc
or std
only.
pub fn from_root(self) -> ScopeFromRoot<'a, R> โ
alloc
or std
only.Flips the order of the iterator, so that it is ordered from root to leaf.
The iterator will first return the root span, then that spanโs immediate child,
and so on until it finally returns the span that SpanRef::scope
was called on.
If any items were consumed from the Scope
before calling this method then they
will not be returned from the ScopeFromRoot
.
Note: this will allocate if there are many spans remaining, or if the โsmallvecโ feature flag is not enabled.
Trait Implementationsยง
Sourceยงimpl<'a, R> Iterator for Scope<'a, R>where
R: LookupSpan<'a>,
impl<'a, R> Iterator for Scope<'a, R>where
R: LookupSpan<'a>,
Sourceยงfn next(&mut self) -> Option<Self::Item> โ
fn next(&mut self) -> Option<Self::Item> โ
Sourceยงfn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk
#98326)N
values. Read more1.0.0 ยท Sourceยงfn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
1.0.0 ยท Sourceยงfn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere
Self: Sized,
1.0.0 ยท Sourceยงfn last(self) -> Option<Self::Item> โwhere
Self: Sized,
fn last(self) -> Option<Self::Item> โwhere
Self: Sized,
Sourceยงfn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 ยท Sourceยงfn nth(&mut self, n: usize) -> Option<Self::Item> โ
fn nth(&mut self, n: usize) -> Option<Self::Item> โ
n
th element of the iterator. Read more1.28.0 ยท Sourceยงfn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 ยท Sourceยงfn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
1.0.0 ยท Sourceยงfn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
Sourceยงfn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
between adjacent items of the original iterator. Read more1.0.0 ยท Sourceยงfn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 ยท Sourceยงfn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 ยท Sourceยงfn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 ยท Sourceยงfn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 ยท Sourceยงfn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 ยท Sourceยงfn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 ยท Sourceยงfn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 ยท Sourceยงfn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 ยท Sourceยงfn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read more1.0.0 ยท Sourceยงfn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 ยท Sourceยงfn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Sourceยงfn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
iter_map_windows
#87155)f
for each contiguous window of size N
over
self
and returns an iterator over the outputs of f
. Like slice::windows()
,
the windows during mapping overlap as well. Read more1.0.0 ยท Sourceยงfn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 ยท Sourceยงfn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Iterator
. Read moreSourceยงfn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 ยท Sourceยงfn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Sourceยงfn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 ยท Sourceยงfn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
1.27.0 ยท Sourceยงfn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 ยท Sourceยงfn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 ยท Sourceยงfn reduce<F>(self, f: F) -> Option<Self::Item> โ
fn reduce<F>(self, f: F) -> Option<Self::Item> โ
Sourceยงfn try_reduce<R>(
&mut self,
f: impl FnMut(Self::Item, Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 ยท Sourceยงfn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 ยท Sourceยงfn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 ยท Sourceยงfn find<P>(&mut self, predicate: P) -> Option<Self::Item> โ
fn find<P>(&mut self, predicate: P) -> Option<Self::Item> โ
1.30.0 ยท Sourceยงfn find_map<B, F>(&mut self, f: F) -> Option<B> โ
fn find_map<B, F>(&mut self, f: F) -> Option<B> โ
Sourceยงfn try_find<R>(
&mut self,
f: impl FnMut(&Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
#63178)1.0.0 ยท Sourceยงfn position<P>(&mut self, predicate: P) -> Option<usize> โ
fn position<P>(&mut self, predicate: P) -> Option<usize> โ
1.6.0 ยท Sourceยงfn max_by_key<B, F>(self, f: F) -> Option<Self::Item> โ
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item> โ
1.15.0 ยท Sourceยงfn max_by<F>(self, compare: F) -> Option<Self::Item> โ
fn max_by<F>(self, compare: F) -> Option<Self::Item> โ
1.6.0 ยท Sourceยงfn min_by_key<B, F>(self, f: F) -> Option<Self::Item> โ
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item> โ
1.15.0 ยท Sourceยงfn min_by<F>(self, compare: F) -> Option<Self::Item> โ
fn min_by<F>(self, compare: F) -> Option<Self::Item> โ
1.0.0 ยท Sourceยงfn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 ยท Sourceยงfn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Sourceยงfn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 ยท Sourceยงfn product<P>(self) -> P
fn product<P>(self) -> P
Sourceยงfn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
iter_order_by
#64295)Iterator
with those
of another with respect to the specified comparison function. Read more1.5.0 ยท Sourceยงfn partial_cmp<I>(self, other: I) -> Option<Ordering> โ
fn partial_cmp<I>(self, other: I) -> Option<Ordering> โ
PartialOrd
elements of
this Iterator
with those of another. The comparison works like short-circuit
evaluation, returning a result without comparing the remaining elements.
As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSourceยงfn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering> โwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering> โwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those
of another with respect to the specified comparison function. Read moreSourceยงfn eq_by<I, F>(self, other: I, eq: F) -> bool
fn eq_by<I, F>(self, other: I, eq: F) -> bool
iter_order_by
#64295)1.5.0 ยท Sourceยงfn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically
less than those of another. Read more1.5.0 ยท Sourceยงfn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically
less or equal to those of another. Read more1.5.0 ยท Sourceยงfn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than those of another. Read more1.5.0 ยท Sourceยงfn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than or equal to those of another. Read more