diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-07-27 14:51:19 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-07-27 14:52:46 -0700 |
| commit | 01e2471cb7bc7f84863bdb0d67cfa2af16d54f9e (patch) | |
| tree | dd3e607ce180e39a3f1a6ee9bf123fda13db3dbd /src/libstd/bitv.rs | |
| parent | b6aadf56c8a6e603c79a8924e6a92398471de8cf (diff) | |
core: Trait-ify various overloaded operators
Diffstat (limited to 'src/libstd/bitv.rs')
| -rw-r--r-- | src/libstd/bitv.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index adb7f56ef3b..145ceba4ae5 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -239,7 +239,7 @@ trait methods { fn union(rhs: bitv) -> bool; fn intersect(rhs: bitv) -> bool; fn assign(rhs: bitv) -> bool; - fn get(i: uint) -> bool; + pure fn get(i: uint) -> bool; fn [](i: uint) -> bool; fn eq(rhs: bitv) -> bool; fn clear(); @@ -261,7 +261,7 @@ impl of methods for bitv { fn union(rhs: bitv) -> bool { union(self, rhs) } fn intersect(rhs: bitv) -> bool { intersect(self, rhs) } fn assign(rhs: bitv) -> bool { assign(self, rhs) } - fn get(i: uint) -> bool { get(self, i) } + pure fn get(i: uint) -> bool { get(self, i) } fn [](i: uint) -> bool { self.get(i) } fn eq(rhs: bitv) -> bool { equal(self, rhs) } fn clear() { clear(self) } @@ -285,6 +285,12 @@ impl of methods for bitv { } } +impl extensions of ops::index<uint,bool> for bitv { + pure fn index(&&i: uint) -> bool { + self.get(i) + } +} + impl of to_str::to_str for bitv { fn to_str() -> ~str { to_str(self) } } |
