{"id":18763665,"url":"https://github.com/akvize/range-cmp","last_synced_at":"2025-04-13T04:32:44.606Z","repository":{"id":204503136,"uuid":"709281953","full_name":"Akvize/range-cmp","owner":"Akvize","description":"Trait that allows comparing a value to a range of values.","archived":false,"fork":false,"pushed_at":"2023-11-08T12:56:24.000Z","size":31,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T21:45:55.390Z","etag":null,"topics":["rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Akvize.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-24T12:03:30.000Z","updated_at":"2023-11-08T09:21:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"6351e4ca-6c4e-494c-b6b9-40d600f3e26f","html_url":"https://github.com/Akvize/range-cmp","commit_stats":null,"previous_names":["akvize/range-cmp"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akvize%2Frange-cmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akvize%2Frange-cmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akvize%2Frange-cmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akvize%2Frange-cmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Akvize","download_url":"https://codeload.github.com/Akvize/range-cmp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248660080,"owners_count":21141237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust"],"created_at":"2024-11-07T18:26:57.330Z","updated_at":"2025-04-13T04:32:44.598Z","avatar_url":"https://github.com/Akvize.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# range_cmp\n\n[![Crates.io][crates-badge]][crates-url]\n[![MIT licensed][mit-badge]][mit-url]\n[![Apache licensed][apache-badge]][apache-url]\n[![Build Status][actions-badge]][actions-url]\n\n[crates-badge]: https://img.shields.io/crates/v/range-cmp.svg\n[crates-url]: https://crates.io/crates/range-cmp\n[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg\n[mit-url]: https://github.com/Akvize/range-cmp/blob/master/LICENSE-MIT\n[apache-badge]: https://img.shields.io/badge/license-APACHE-blue.svg\n[apache-url]: https://github.com/Akvize/range-cmp/blob/master/LICENSE-APACHE\n[actions-badge]: https://github.com/Akvize/range-cmp/actions/workflows/ci.yml/badge.svg\n[actions-url]: https://github.com/Akvize/range-cmp/actions/workflows/ci.yml\n\n[Docs](https://docs.rs/range-cmp/latest/range_cmp/)\n\nThis Rust crate provides the `RangeComparable` trait on all types that\nimplement `Ord`. This traits exposes a `rcmp` associated method\nthat allows comparing a value with a range of values:\n\n```rust\nuse range_cmp::{RangeComparable, RangeOrdering};\nassert_eq!(15.rcmp(20..30), RangeOrdering::Below);\nassert_eq!(25.rcmp(20..30), RangeOrdering::Inside);\nassert_eq!(35.rcmp(20..30), RangeOrdering::Above);\n```\n## Empty ranges handling\n\nThis crate _does not_ strictly handle empty ranges, \nwhich are not mathematically comparable. In this case, \nrange_cmp will show different behavior depending on\nthe representation of the empty range. For instance:\n\n```rust\nassert_eq!(30.range_cmp(45..35), RangeOrdering::Below);\nassert_eq!(30.range_cmp(25..15), RangeOrdering::Above);\nassert_eq!(0.range_cmp(0..0), RangeOrdering::Above);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakvize%2Frange-cmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakvize%2Frange-cmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakvize%2Frange-cmp/lists"}