]> git.lizzy.rs Git - rust.git/commitdiff
add constructor to TrieSet (was missing)
authorDaniel Micay <danielmicay@gmail.com>
Sat, 16 Mar 2013 01:03:29 +0000 (21:03 -0400)
committerDaniel Micay <danielmicay@gmail.com>
Sat, 16 Mar 2013 01:03:29 +0000 (21:03 -0400)
src/libcore/trie.rs

index 966db4ec66207cfc1bf6b6e97427d0463b72489a..d6dcad334085da1ad255fb58f9c6e970ef1d328f 100644 (file)
@@ -137,6 +137,7 @@ fn remove(&mut self, key: &uint) -> bool {
 }
 
 impl<T> TrieMap<T> {
+    /// Create an empty TrieMap
     #[inline(always)]
     static pure fn new() -> TrieMap<T> {
         TrieMap{root: TrieNode::new(), length: 0}
@@ -191,6 +192,12 @@ fn clear(&mut self) { self.map.clear() }
 }
 
 impl TrieSet {
+    /// Create an empty TrieSet
+    #[inline(always)]
+    static pure fn new() -> TrieSet {
+        TrieSet{map: TrieMap::new()}
+    }
+
     /// Return true if the set contains a value
     #[inline(always)]
     pure fn contains(&self, value: &uint) -> bool {