From 69540de74e944fedb7f6c48c801abc95c98e270c Mon Sep 17 00:00:00 2001 From: Pierre Talbot Date: Wed, 27 May 2015 11:46:55 +0200 Subject: [PATCH] Add IntervalKind marker to avoid selecting StrictShrinkLeft or Right on Option type. --- src/libinterval/ncollections/mod.rs | 2 ++ src/libinterval/ncollections/ops.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libinterval/ncollections/mod.rs b/src/libinterval/ncollections/mod.rs index cac4b0a..16576e0 100644 --- a/src/libinterval/ncollections/mod.rs +++ b/src/libinterval/ncollections/mod.rs @@ -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; diff --git a/src/libinterval/ncollections/ops.rs b/src/libinterval/ncollections/ops.rs index a1a9e98..27fbb98 100644 --- a/src/libinterval/ncollections/ops.rs +++ b/src/libinterval/ncollections/ops.rs @@ -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 { @@ -186,7 +190,7 @@ pub trait StrictShrinkRight { impl StrictShrinkLeft for R where Bound: num::PrimInt, - R: ShrinkLeft + Empty + R: ShrinkLeft + Empty + IntervalKind { fn strict_shrink_left(&self, lb: Bound) -> R { if lb == Bound::max_value() { @@ -199,7 +203,7 @@ impl StrictShrinkLeft for R where impl StrictShrinkRight for R where Bound: num::PrimInt, - R: ShrinkRight + Empty + R: ShrinkRight + Empty + IntervalKind { fn strict_shrink_right(&self, ub: Bound) -> R { if ub == Bound::min_value() {