any-range 0.1.4

AnyRange<T> enum can hold any Range*<T> type
Documentation
  • Coverage
  • 50%
    6 out of 12 items documented3 out of 6 items with examples
  • Size
  • Source code size: 14.52 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.91 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • leonhard-llc/ops
    14 6 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mleonhard

any-range

crates.io version license: Apache 2.0 unsafe forbidden pipeline status

AnyRange<T> enum can hold any Range*<T> type.

Use Cases

  • Store any kind of range in a struct without adding a type parameter

Features

  • no_std, depends only on core
  • forbid(unsafe_code)
  • 100% test coverage

Limitations

  • Uses more bytes than a plain Range<T>. The alignment of T determines how many extra bytes the enum uses.

Alternatives

  • anyrange
    • Should be called ToRange
    • Doesn't support RangeInclusive or RangeToInclusive
    • Unmaintained

Example

use any_range::AnyRange;
let r = AnyRange::from(3..5);
assert!(r.contains(&3));
assert_eq!("de", &"abcdefg"[r.bounds()]);

Cargo Geiger Safety Report


Metric output format: x/y
    x = unsafe code used by the build
    y = total unsafe code found in the crate

Symbols: 
    🔒  = No `unsafe` usage found, declares #![forbid(unsafe_code)]
    ❓  = No `unsafe` usage found, missing #![forbid(unsafe_code)]
    ☢️  = `unsafe` usage found

Functions  Expressions  Impls  Traits  Methods  Dependency

0/0        0/0          0/0    0/0     0/0      🔒  any-range 0.1.4

0/0        0/0          0/0    0/0     0/0    

Changelog

  • v0.1.4 - Add bounds method for slicing
  • v0.1.3 - Implement Hash, PartialOrd, Ord
  • v0.1.2 - Increase test coverage
  • v0.1.1 - Update docs
  • v0.1.0 - Initial version

License: Apache-2.0