diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-05-31 15:17:22 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-06-01 09:18:27 -0700 |
| commit | 5fb254695b4db9af3d8e33577fae28ae9f7006c5 (patch) | |
| tree | 33a4db59bd936a73594ca144e809b6074d6ccef3 /src/libsyntax/util | |
| parent | 1e52eede31a1df3627bfa9f43b9d06c730895c01 (diff) | |
| download | rust-5fb254695b4db9af3d8e33577fae28ae9f7006c5.tar.gz rust-5fb254695b4db9af3d8e33577fae28ae9f7006c5.zip | |
Remove all uses of `pub impl`. rs=style
Diffstat (limited to 'src/libsyntax/util')
| -rw-r--r-- | src/libsyntax/util/interner.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index e2736a00564..c3deb65163d 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -27,21 +27,21 @@ pub struct Interner<T> { } // when traits can extend traits, we should extend index<uint,T> to get [] -pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> { - fn new() -> Interner<T> { +impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> { + pub fn new() -> Interner<T> { Interner { map: @mut HashMap::new(), vect: @mut ~[], } } - fn prefill(init: &[T]) -> Interner<T> { + pub fn prefill(init: &[T]) -> Interner<T> { let rv = Interner::new(); for init.each() |v| { rv.intern(*v); } rv } - fn intern(&self, val: T) -> uint { + pub fn intern(&self, val: T) -> uint { match self.map.find(&val) { Some(&idx) => return idx, None => (), @@ -54,7 +54,7 @@ pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> { new_idx } - fn gensym(&self, val: T) -> uint { + pub fn gensym(&self, val: T) -> uint { let new_idx = { let vect = &*self.vect; vect.len() @@ -67,11 +67,11 @@ pub impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> { // this isn't "pure" in the traditional sense, because it can go from // failing to returning a value as items are interned. But for typestate, // where we first check a pred and then rely on it, ceasing to fail is ok. - fn get(&self, idx: uint) -> T { self.vect[idx] } + pub fn get(&self, idx: uint) -> T { self.vect[idx] } - fn len(&self) -> uint { let vect = &*self.vect; vect.len() } + pub fn len(&self) -> uint { let vect = &*self.vect; vect.len() } - fn find_equiv<Q:Hash + IterBytes + Equiv<T>>(&self, val: &Q) + pub fn find_equiv<Q:Hash + IterBytes + Equiv<T>>(&self, val: &Q) -> Option<uint> { match self.map.find_equiv(val) { Some(v) => Some(*v), @@ -88,21 +88,21 @@ pub struct StrInterner { } // when traits can extend traits, we should extend index<uint,T> to get [] -pub impl StrInterner { - fn new() -> StrInterner { +impl StrInterner { + pub fn new() -> StrInterner { StrInterner { map: @mut HashMap::new(), vect: @mut ~[], } } - fn prefill(init: &[&str]) -> StrInterner { + pub fn prefill(init: &[&str]) -> StrInterner { let rv = StrInterner::new(); for init.each() |v| { rv.intern(*v); } rv } - fn intern(&self, val: &str) -> uint { + pub fn intern(&self, val: &str) -> uint { match self.map.find_equiv(&StringRef(val)) { Some(&idx) => return idx, None => (), @@ -114,7 +114,7 @@ pub impl StrInterner { new_idx } - fn gensym(&self, val: &str) -> uint { + pub fn gensym(&self, val: &str) -> uint { let new_idx = self.len(); // leave out of .map to avoid colliding self.vect.push(@val.to_owned()); @@ -124,12 +124,12 @@ pub impl StrInterner { // this isn't "pure" in the traditional sense, because it can go from // failing to returning a value as items are interned. But for typestate, // where we first check a pred and then rely on it, ceasing to fail is ok. - fn get(&self, idx: uint) -> @~str { self.vect[idx] } + pub fn get(&self, idx: uint) -> @~str { self.vect[idx] } - fn len(&self) -> uint { let vect = &*self.vect; vect.len() } + pub fn len(&self) -> uint { let vect = &*self.vect; vect.len() } - fn find_equiv<Q:Hash + IterBytes + Equiv<@~str>>(&self, val: &Q) - -> Option<uint> { + pub fn find_equiv<Q:Hash + IterBytes + Equiv<@~str>>(&self, val: &Q) + -> Option<uint> { match self.map.find_equiv(val) { Some(v) => Some(*v), None => None, |
