Trait staticstep::IntoIncBy [−][src]
A subtrait of RangeBounds<T>
where T
is Copy + Default + Step
that turns implementers of it into an instance of IncBy
when
inc_by
is called.
Required methods
fn inc_by<const STEP: usize>(self) -> IncBy<T, STEP>ⓘ
[src]
Functionally equivalent to what step_by
does when it is
called through a primitive range, but written specifically with primitive ranges in mind such
that it optimizes identically to a while
loop in every case the author of this crate has
examined so far.
Example usage:
// Exclusive, so prints: 'A C E' for i in ('A'..'G').inc_by::<2>() { print!("{} ", i); } // Inclusive, so prints: '0 4 8 12' for i in (0isize..=12isize).inc_by::<4>() { print!("{} ", i); }
Implementors
impl<T: Copy + Default + Step, R: RangeBounds<T>> IntoIncBy<T> for R
[src]
The actual implementation of IntoIncBy
for
RangeBounds
.