Trait staticstep::IntoDecBy[][src]

pub trait IntoDecBy<T: Copy + Default + Step>: RangeBounds<T> {
    fn dec_by<const STEP: usize>(self) -> DecBy<T, STEP>

Notable traits for DecBy<T, STEP>

impl<T: Copy + Default + Step, const STEP: usize> Iterator for DecBy<T, STEP> type Item = T;
; }

A subtrait of RangeBounds<T> where T is Copy + Default + Step that turns implementers of it into an instance of DecBy when dec_by is called.

Required methods

fn dec_by<const STEP: usize>(self) -> DecBy<T, STEP>

Notable traits for DecBy<T, STEP>

impl<T: Copy + Default + Step, const STEP: usize> Iterator for DecBy<T, STEP> type Item = T;
[src]

Functionally equivalent to what step_by does when it is called through a primitive range, but specifically in reverse and operating directly on ranges that are themselves syntactically “backwards”, while offering the same level of optimizability as inc_by.

Example usage:

// Exclusive, so prints: 'G E C'
for i in ('G'..'A').dec_by::<2>() {
  print!("{} ", i);
}

// Inclusive, so prints: '4 1 -2'
for i in (4isize..=-4isize).dec_by::<3>() {
  print!("{} ", i);
}
Loading content...

Implementors

impl<T: Copy + Default + Step, R: RangeBounds<T>> IntoDecBy<T> for R[src]

The actual implementation of IntoDecBy for RangeBounds.

Loading content...