Skip to content

Commit 10920ff

Browse files
committed
---
yaml --- r: 143310 b: refs/heads/try2 c: d6bc438 h: refs/heads/master v: v3
1 parent 3999c11 commit 10920ff

File tree

18 files changed

+363
-337
lines changed

18 files changed

+363
-337
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 098106870e0ebdebb40964624185f304ee7b3d63
8+
refs/heads/try2: d6bc438bbcb9240d0303ffec81bf1a617f0903a5
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,8 +703,8 @@ impl cmp::Eq for BitvSet {
703703
}
704704

705705
impl Container for BitvSet {
706-
#[inline]
707706
fn len(&self) -> uint { self.size }
707+
fn is_empty(&self) -> bool { self.size == 0 }
708708
}
709709

710710
impl Mutable for BitvSet {

branches/try2/src/libextra/priority_queue.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ pub struct PriorityQueue<T> {
2727
impl<T:Ord> Container for PriorityQueue<T> {
2828
/// Returns the length of the queue
2929
fn len(&self) -> uint { self.data.len() }
30+
31+
/// Returns true if a queue contains no elements
32+
fn is_empty(&self) -> bool { self.len() == 0 }
3033
}
3134

3235
impl<T:Ord> Mutable for PriorityQueue<T> {

branches/try2/src/libextra/ringbuf.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ pub struct RingBuf<T> {
3434
impl<T> Container for RingBuf<T> {
3535
/// Return the number of elements in the RingBuf
3636
fn len(&self) -> uint { self.nelts }
37+
38+
/// Return true if the RingBufcontains no elements
39+
fn is_empty(&self) -> bool { self.len() == 0 }
3740
}
3841

3942
impl<T> Mutable for RingBuf<T> {

branches/try2/src/libextra/smallintmap.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ impl<V> Container for SmallIntMap<V> {
3737
}
3838
sz
3939
}
40+
41+
/// Return true if the map contains no elements
42+
fn is_empty(&self) -> bool { self.len() == 0 }
4043
}
4144

4245
impl<V> Mutable for SmallIntMap<V> {

branches/try2/src/libextra/treemap.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ impl<K: TotalOrd, V> MutableMap<K, V> for TreeMap<K, V> {
135135
find_mut(&mut self.root, key)
136136
}
137137

138+
/// Insert a key-value pair into the map. An existing value for a
139+
/// key is replaced by the new value. Return true if the key did
140+
/// not already exist in the map.
141+
fn insert(&mut self, key: K, value: V) -> bool {
142+
self.swap(key, value).is_none()
143+
}
144+
145+
/// Remove a key-value pair from the map. Return true if the key
146+
/// was present in the map, otherwise false.
147+
fn remove(&mut self, key: &K) -> bool {
148+
self.pop(key).is_some()
149+
}
150+
138151
/// Insert a key-value pair from the map. If the key already had a value
139152
/// present in the map, that value is returned. Otherwise None is returned.
140153
fn swap(&mut self, key: K, value: V) -> Option<V> {

0 commit comments

Comments
 (0)