1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 #![allow(non_camel_case_types)]
15 fn to_bytes(&self) -> Vec
<u8> ;
19 fn to_bytes(&self) -> Vec
<u8> {
24 // the position of this function is significant! - if it comes before methods
25 // then it works, if it comes after it then it doesn't!
26 fn to_bools(bitv
: Storage
) -> Vec
<bool
> {
30 let x
= 1 & (bitv
.storage
[w
] >> b
);
35 struct Storage { storage: Vec<u64> }
38 let bools
= vec
![false, false, true, false, false, true, true, false];
39 let bools2
= to_bools(Storage{storage: vec![0b01100100]}
);
42 println
!("{} => {} vs {}", i
, bools
[i
], bools2
[i
]);
45 assert_eq
!(bools
, bools2
);