Giter VIP home page Giter VIP logo

more_ranges's Introduction

more_ranges

GitHub Workflow Status codecov.io crates.io docs.rs MSRV License

Range types not provided in the standard library.

This crate provides range types that are bounded exclusively below. Specifically, the types provided are:

These ranges operate nearly the same as those in std::ops. However, they do not function as Iterators, nor can they be used in indexing.

Example

The range types provided here can be used by directly specifying their fields:

use more_ranges::{RangeFromExclusive, RangeFromExclusiveToExclusive, RangeFromExclusiveToInclusive};

let range_from_exclusive = RangeFromExclusive { start: 1 };
let range_from_exclusive_to_exclusive = RangeFromExclusiveToExclusive { start: 1, end: 4 };
let range_from_exclusive_to_inclusive = RangeFromExclusiveToInclusive { start: 1, end: 4 };

Minimum Supported Rust Version

This crate is guaranteed to compile on stable rustc 1.28.0 and up.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

more_ranges's People

Contributors

anders429 avatar dependabot-preview[bot] avatar

Watchers

 avatar  avatar

more_ranges's Issues

0.2.0 Checklist

This is the checklist of things that need to happen before the 0.2.0 release.

  • Implement Iterator.
  • Implement DoubleEndedIterator.
  • Implement FusedIterator.
  • Implement ExactSizeIterator. These must be dependent on the target's pointer width.
  • Implement TrustedLen.
  • Implement Index for [T], Vec<T>, &str, and String. Also implement Index for CStr using RangeFromExclusive.
  • Implement Serialize and
    Deserialize from serde.
  • autocfg is working towards some form of nightly feature probing. This needs to be available to make the above features usable, since some of them require nightly, but we don't want to restrict the crate to nightly.
  • Set up documentation using doc_item to make it more clear what the requirements are for certain parts of the crate.
  • rustdoc issue with foreign implementations not being shown in documentation needs to be resolved (see #2). This only needs to be available in nightly, since that is what docs.rs uses. We need this to be fixed before release, or else half of the documentation will be missing. There is a PR to fix it, but it seems to be blocked currently.

Support Iterating and Indexing on Nightly

It seems that supporting Iterating and Indexing on stable is tricky at the moment, due std::iter::Step and std::slice::SliceIndex having experimental APIs. For Step, I've considered using the step crate to accomplish the same purpose. The only issue is it forces users to implement step::Step if they want to iterate over a custom steppable range.

An alternative is to make iterating and indexing both available, in the same manner as they are implemented for the standard library range types, on nightly channels only. It seems that [autocfg](https://crates.io/crates/autocfg does not currently offer probing channels yet, although it may come in the future. rustc_version is another crate which can probe channels.

Another possibility is to lock iterating and indexing behind a nightly feature, allowing users to opt-in using cargo features.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.