Step in std::iter - Rust (original) (raw)

logo

🔬 This is a nightly-only experimental API. (step_trait #42168)

Expand description

Objects that have a notion of successor and predecessor operations.

The successor operation moves towards values that compare greater. The predecessor operation moves towards values that compare lesser.

🔬 This is a nightly-only experimental API. (step_trait #42168)

Returns the number of successor steps required to get from start to end.

Returns None if the number of steps would overflow usize(or is infinite, or if end would never be reached).

For any a, b, and n:

🔬 This is a nightly-only experimental API. (step_trait #42168)

Returns the value that would be obtained by taking the _successor_of self count times.

If this would overflow the range of values supported by Self, returns None.

For any a, n, and m:

For any a, n, and m where n + m does not overflow:

For any a and n:

🔬 This is a nightly-only experimental API. (step_trait #42168)

Returns the value that would be obtained by taking the _predecessor_of self count times.

If this would overflow the range of values supported by Self, returns None.

For any a, n, and m:

For any a and n:

🔬 This is a nightly-only experimental API. (step_trait #42168)

Returns the value that would be obtained by taking the _successor_of self count times.

If this would overflow the range of values supported by Self, this function is allowed to panic, wrap, or saturate. The suggested behavior is to panic when debug assertions are enabled, and to wrap or saturate otherwise.

Unsafe code should not rely on the correctness of behavior after overflow.

For any a, n, and m, where no overflow occurs:

For any a and n, where no overflow occurs:

🔬 This is a nightly-only experimental API. (step_trait #42168)

Returns the value that would be obtained by taking the _successor_of self count times.

It is undefined behavior for this operation to overflow the range of values supported by Self. If you cannot guarantee that this will not overflow, use forward or forward_checked instead.

For any a:

For any a and n, where no overflow occurs:

🔬 This is a nightly-only experimental API. (step_trait #42168)

Returns the value that would be obtained by taking the _predecessor_of self count times.

If this would overflow the range of values supported by Self, this function is allowed to panic, wrap, or saturate. The suggested behavior is to panic when debug assertions are enabled, and to wrap or saturate otherwise.

Unsafe code should not rely on the correctness of behavior after overflow.

For any a, n, and m, where no overflow occurs:

For any a and n, where no overflow occurs:

🔬 This is a nightly-only experimental API. (step_trait #42168)

Returns the value that would be obtained by taking the _predecessor_of self count times.

It is undefined behavior for this operation to overflow the range of values supported by Self. If you cannot guarantee that this will not overflow, use backward or backward_checked instead.

For any a:

For any a and n, where no overflow occurs: