src/sets.rs

changeset 202
7a1f1f6f34b5
parent 171
fa8df5a14486
equal deleted inserted replaced
201:ea2d1e40d707 202:7a1f1f6f34b5
33 33
34 impl<U, const N: usize> Set<Loc<N, U>> for Cube<N, U> 34 impl<U, const N: usize> Set<Loc<N, U>> for Cube<N, U>
35 where 35 where
36 U: Num + PartialOrd + Sized, 36 U: Num + PartialOrd + Sized,
37 { 37 {
38 #[inline]
38 fn contains<I: Instance<Loc<N, U>>>(&self, item: I) -> bool { 39 fn contains<I: Instance<Loc<N, U>>>(&self, item: I) -> bool {
39 item.eval_ref(|r| self.0.iter().zip(r.iter()).all(|(s, x)| s.contains(x))) 40 item.eval_ref(|r| self.0.iter().zip(r.iter()).all(|([a, b], x)| a<=x && x<=b))
40 } 41 }
41 } 42 }
42 43
43 impl<U: Space> Set<U> for RangeFull { 44 impl<U: Space> Set<U> for RangeFull {
44 fn contains<I: Instance<U>>(&self, _item: I) -> bool { 45 fn contains<I: Instance<U>>(&self, _item: I) -> bool {

mercurial