pub struct TargetIndex { /* private fields */ }Expand description
The same targets TargetMap::iter yields, addressed by position instead of
walked in order.
iter numbers a plan: its nth target is position n, and a journal
records progress as one of those numbers. A scan asking in another order needs the
reverse, the target a position names, which this provides.
The dispatcher decides what to probe by one and the cursor records what was probed
by the other, so target_at must agree with iter().nth() for
every position; the tests below hold it to that.
Costs a few words per unit and nothing per target. Addresses are numbered by
Positions, a table of a unit’s ranges; a position resolves with one binary
search and two divisions.
Implementations§
Source§impl TargetIndex
impl TargetIndex
Sourcepub fn of(map: &TargetMap) -> Self
pub fn of(map: &TargetMap) -> Self
Numbers map’s targets.
Numbering stops at the first unit that cannot be counted whole, and every unit
after it is left out, since positions must stay contiguous (as in
Positions). is_complete then answers false; a caller
that needs the whole plan addressed checks that first.
A unit is uncountable when its addresses are (an IPv6 range of a /64 or
wider), or when addresses times ports overflows the numbering. Both describe a
plan no scan finishes.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether every target the map holds is numbered.
False for a plan whose addresses outrun the numbering, where
total counts only a prefix of TargetMap::iter. A caller
walking positions must check this, or it covers part of the plan and reports
all of it.
Trait Implementations§
Source§impl Clone for TargetIndex
impl Clone for TargetIndex
Auto Trait Implementations§
impl Freeze for TargetIndex
impl RefUnwindSafe for TargetIndex
impl Send for TargetIndex
impl Sync for TargetIndex
impl Unpin for TargetIndex
impl UnsafeUnpin for TargetIndex
impl UnwindSafe for TargetIndex
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more