From 2c9922aa491f406d0a17631ef2f0bfc0bbf85346 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Wed, 7 Aug 2013 14:29:29 +0200 Subject: Enable privacy check for enum methods. --- src/libsyntax/opt_vec.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/libsyntax/opt_vec.rs') diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index 10603751a06..a6f6b9d48e2 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -36,7 +36,7 @@ pub fn from(t: ~[T]) -> OptVec { } impl OptVec { - fn push(&mut self, t: T) { + pub fn push(&mut self, t: T) { match *self { Vec(ref mut v) => { v.push(t); @@ -50,32 +50,32 @@ impl OptVec { *self = Vec(~[t]); } - fn map(&self, op: &fn(&T) -> U) -> OptVec { + pub fn map(&self, op: &fn(&T) -> U) -> OptVec { match *self { Empty => Empty, Vec(ref v) => Vec(v.map(op)) } } - fn map_consume(self, op: &fn(T) -> U) -> OptVec { + pub fn map_consume(self, op: &fn(T) -> U) -> OptVec { match self { Empty => Empty, Vec(v) => Vec(v.consume_iter().transform(op).collect()) } } - fn get<'a>(&'a self, i: uint) -> &'a T { + pub fn get<'a>(&'a self, i: uint) -> &'a T { match *self { Empty => fail!("Invalid index %u", i), Vec(ref v) => &v[i] } } - fn is_empty(&self) -> bool { + pub fn is_empty(&self) -> bool { self.len() == 0 } - fn len(&self) -> uint { + pub fn len(&self) -> uint { match *self { Empty => 0, Vec(ref v) => v.len() @@ -83,7 +83,7 @@ impl OptVec { } #[inline] - fn iter<'r>(&'r self) -> OptVecIterator<'r, T> { + pub fn iter<'r>(&'r self) -> OptVecIterator<'r, T> { match *self { Empty => OptVecIterator{iter: None}, Vec(ref v) => OptVecIterator{iter: Some(v.iter())} @@ -91,11 +91,11 @@ impl OptVec { } #[inline] - fn map_to_vec(&self, op: &fn(&T) -> B) -> ~[B] { + pub fn map_to_vec(&self, op: &fn(&T) -> B) -> ~[B] { self.iter().transform(op).collect() } - fn mapi_to_vec(&self, op: &fn(uint, &T) -> B) -> ~[B] { + pub fn mapi_to_vec(&self, op: &fn(uint, &T) -> B) -> ~[B] { let mut index = 0; self.map_to_vec(|a| { let i = index; @@ -113,7 +113,7 @@ pub fn take_vec(v: OptVec) -> ~[T] { } impl OptVec { - fn prepend(&self, t: T) -> OptVec { + pub fn prepend(&self, t: T) -> OptVec { let mut v0 = ~[t]; match *self { Empty => {} @@ -124,7 +124,7 @@ impl OptVec { } impl Eq for OptVec { - fn eq(&self, other: &OptVec) -> bool { + pub fn eq(&self, other: &OptVec) -> bool { // Note: cannot use #[deriving(Eq)] here because // (Empty, Vec(~[])) ought to be equal. match (self, other) { @@ -135,7 +135,7 @@ impl Eq for OptVec { } } - fn ne(&self, other: &OptVec) -> bool { + pub fn ne(&self, other: &OptVec) -> bool { !self.eq(other) } } -- cgit 1.4.1-3-g733a5