Comments (7)
Yup, I'm putting a bound for PartialOrd
for Idx
.
from a-range.
Looks like a good time to learn Rust. Can I work on this?
from a-range.
Absolutely! Let me know if you have any questions!
from a-range.
Hi! would you like me to throw explicit panic
s or do you have something else in mind?
from a-range.
@babhishek21 good question. I'd go with a panic for now, as it's most likely a programmer error; in teh future, we can introduce try_up_to
and similar if people ask for it.
from a-range.
@killercup So, I was going to put in panic
s of the sort:
panic!("Cannot count upwards from {} to {}", self.from, x); // `self.from` and `x` are both of generic type `Idx`
But that'd mean putting bounds for Idx
to be std::fmt::Display
able (which really shouldn't be hard requirement for consumers of this crate). So how do I keep my panic
s descriptive enough?
from a-range.
Well, you could use debug output ({:?}
) but that'd require Debug
, of course. It's implemented by more types, but still a needless constraint.
I'd probably just go with a generic message like "invalid range: upper bound cannot be less than lower bound" (or reverse for⦠reverse).
Speaking of bounds: Seems like this also means we'll need PartialOrd
to check of <=
/>=
. It's a bit stricter than PartialEq
, but does make sense over all.
from a-range.
Related Issues (13)
- Convert to std::ops::Range*
- Doc tests for `Range::collect()` HOT 2
- Add doc tests to Panic documentation HOT 3
- Add documentation and doc test for `from(i).up_to(i)` case HOT 2
- Move crate-level docs into Readme and include it HOT 3
- Make unit tests for std::ops::Range converstion doc tests HOT 1
- Copy semantics/Trait for a_range::From HOT 2
- .up_to_infinity() HOT 1
- Proposal: Make `Direction` unsealed to enable multidimensional extensions
- Add docs with non-integer index types
- Write property tests
- Add `.iter` method on `Range` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from a-range.