[−][src]Crate dia_range
Dia-range
Ranges for all integers
Project
- Repository: https://bitbucket.org/haibison/dia-range
- License: Nice License 1.0.0 (see LICENSE file at root directory of
master
branch) - This project follows Semantic Versioning 2.0.0
Features
RangeType
andOps
traits are implemented for all integer primitive types. So you can useRange
on them.- Currently only
Range
is recommended for use. BothRangeType
andOps
traits are intended for internal use only. They have to be available publicly forRange
to be valid, but they are sealed.
Notes
The crate uses #![no_std]
by default. Documentation is built with all features, which include std
. If you see some components from
std
crate, you have to use that feature.
Examples
use dia_range::Range; // First type i16 is for indexes; second type (u16) is for estimating range size. // You can ignore second type, the compiler will figure it out. let mut range: Range<i16, _> = Range::new(50, 100); assert!(range.contains(&99)); assert!(range.expand(101)); assert!(range.expand(103) == false); assert!(range.contains(&101)); assert_eq!(range.estimate_size(), 52); // Merging assert_eq!(range.merge(&Range::new(100, 150)), Some(Range::new(50, 150)));
Modules
version_info |
|
Structs
Error | Error |
Range | Range |
RangeIter | Iterator for |
Constants
CODE_NAME | Crate code name |
ID | ID of this crate |
NAME | Crate name |
RELEASE_DATE | Crate release date (year/month/day) |
TAG | Tag, which can be used for logging... |
VERSION | Crate version |
Traits
Ops | Math operations |
RangeType | Helper for |
Functions
merge | Merges ranges |
Type Definitions
Result | Result type used in this crate |