#range #copy #ops #et #al #traits #into-iterator

no-std copy-range

core::ops::Range et al, but Copy and IntoIterator

2 releases

0.1.1 Sep 29, 2023
0.1.0 Sep 2, 2023

#1517 in Data structures

46 downloads per month

MIT/Apache

14KB
288 lines

copy_range

This crate provides three structs: CopyRange, CopyRangeFrom, and CopyRangeInclusive.

They are similar to core::ops's Range, RangeFrom, and RangeInclusive, respectively, except they implement Copy if their element type implements Copy, and they implement IntoIterator instead of Iterator.

They are freely convertible to and from their core::ops counterparts (with a note about RangeInclusive), and they implement most of the same (non-iterator-related) traits, notably RangeBounds.

Ranges of usize are additionally usable as the Index parameter for arrays, slices, string slices and (with the "alloc" feature enabled) Vec and String.


lib.rs:

copy_range provides three structs: CopyRange, CopyRangeFrom, and CopyRangeInclusive.

They are similar to core::ops's Range, RangeFrom, and RangeInclusive, respectively, except they implement Copy if their element type implements Copy, and they implement IntoIterator instead of Iterator.

They are freely convertible to and from their core::ops counterparts (with a note about RangeInclusive), and they implement most of the same (non-iterator-related) traits, notably RangeBounds.

Ranges of usize are additionally usable as the Index parameter for arrays, slices, string slices and (with the "alloc" feature enabled) Vec and String.

No runtime deps

Features