@@ -268,15 +268,6 @@ impl Bitv {
268
268
!self . none ( )
269
269
}
270
270
271
- /**
272
- * Converts `self` to a vector of `uint` with the same length.
273
- *
274
- * Each `uint` in the resulting vector has either value `0u` or `1u`.
275
- */
276
- pub fn to_vec ( & self ) -> Vec < uint > {
277
- Vec :: from_fn ( self . nbits , |i| if self . get ( i) { 1 } else { 0 } )
278
- }
279
-
280
271
/**
281
272
* Organise the bits into bytes, such that the first bit in the
282
273
* `Bitv` becomes the high-order bit of the first byte. If the
@@ -307,13 +298,6 @@ impl Bitv {
307
298
)
308
299
}
309
300
310
- /**
311
- * Transform `self` into a `Vec<bool>` by turning each bit into a `bool`.
312
- */
313
- pub fn to_bools ( & self ) -> Vec < bool > {
314
- Vec :: from_fn ( self . nbits , |i| self [ i] )
315
- }
316
-
317
301
/**
318
302
* Compare a bitvector to a vector of `bool`.
319
303
*
@@ -328,11 +312,6 @@ impl Bitv {
328
312
}
329
313
true
330
314
}
331
-
332
- pub fn ones ( & self , f: |uint| -> bool) -> bool {
333
- range ( 0 u, self . nbits ) . advance ( |i| !self . get ( i) || f ( i) )
334
- }
335
-
336
315
}
337
316
338
317
/**
@@ -1157,7 +1136,7 @@ mod tests {
1157
1136
#[ test]
1158
1137
fn test_to_bools ( ) {
1159
1138
let bools = vec ! ( false , false , true , false , false , true , true , false ) ;
1160
- assert_eq ! ( from_bytes( [ 0b00100110 ] ) . to_bools ( ) , bools) ;
1139
+ assert_eq ! ( from_bytes( [ 0b00100110 ] ) . iter ( ) . collect :: < Vec < bool >> ( ) , bools) ;
1161
1140
}
1162
1141
1163
1142
#[ test]
@@ -1225,7 +1204,7 @@ mod tests {
1225
1204
fn test_small_clear ( ) {
1226
1205
let mut b = Bitv :: new ( 14 , true ) ;
1227
1206
b. clear ( ) ;
1228
- b . ones ( |i| {
1207
+ BitvSet :: from_bitv ( b ) . iter ( ) . advance ( |i| {
1229
1208
fail ! ( "found 1 at {:?}" , i)
1230
1209
} ) ;
1231
1210
}
@@ -1234,7 +1213,7 @@ mod tests {
1234
1213
fn test_big_clear ( ) {
1235
1214
let mut b = Bitv :: new ( 140 , true ) ;
1236
1215
b. clear ( ) ;
1237
- b . ones ( |i| {
1216
+ BitvSet :: from_bitv ( b ) . iter ( ) . advance ( |i| {
1238
1217
fail ! ( "found 1 at {:?}" , i)
1239
1218
} ) ;
1240
1219
}
0 commit comments