Skip to content

Commit

Permalink
Add IntervalKind marker to avoid selecting StrictShrinkLeft or Right …
Browse files Browse the repository at this point in the history
…on Option type.
  • Loading branch information
ptal committed May 27, 2015
1 parent 7d05d4d commit 69540de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/libinterval/ncollections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pub mod btree_set;
pub mod enum_set;
pub mod bit_set;
pub mod ops;
pub mod option;
pub mod primitives;

pub use ncollections::hash_set::HashSet;
pub use ncollections::btree_set::BTreeSet;
Expand Down
8 changes: 6 additions & 2 deletions src/libinterval/ncollections/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ use std::ops::Deref;
use num::{One, Zero, Unsigned};
use num;

// Markers

pub trait IntervalKind {}

// Basic set operations

pub trait Intersection<RHS = Self> {
Expand Down Expand Up @@ -186,7 +190,7 @@ pub trait StrictShrinkRight<Bound> {

impl<Bound, R> StrictShrinkLeft<Bound> for R where
Bound: num::PrimInt,
R: ShrinkLeft<Bound> + Empty
R: ShrinkLeft<Bound> + Empty + IntervalKind
{
fn strict_shrink_left(&self, lb: Bound) -> R {
if lb == Bound::max_value() {
Expand All @@ -199,7 +203,7 @@ impl<Bound, R> StrictShrinkLeft<Bound> for R where

impl<Bound, R> StrictShrinkRight<Bound> for R where
Bound: num::PrimInt,
R: ShrinkRight<Bound> + Empty
R: ShrinkRight<Bound> + Empty + IntervalKind
{
fn strict_shrink_right(&self, ub: Bound) -> R {
if ub == Bound::min_value() {
Expand Down

0 comments on commit 69540de

Please sign in to comment.