1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*SPEC* property ascending<T> { \c -> ((for-all-consecutive-pairs c) leq?) } type AscendingCon<T> = {c impl (Container, Indexable) | (ascending c)} *ENDSPEC*/ fn main () { let mut c = AscendingCon::<u32>::new(); for x in 0..10 { c.insert(x); c.insert(x); } assert_eq!(c.len(), 20); }