fn wb() -> c_int { O_WRONLY as c_int }
let mut fflags: c_int = wb();
- foreach f in flags.iter() {
+ for f in flags.iter() {
match *f {
Append => fflags |= O_APPEND as c_int,
Create => fflags |= O_CREAT as c_int,
if len <= ivals.len() {
assert_eq!(res.len(), len);
}
- foreach (iv, c) in ivals.iter().zip(res.iter()) {
+ for (iv, c) in ivals.iter().zip(res.iter()) {
assert!(*iv == *c as int)
}
}
// write the ints to the file
{
let file = io::file_writer(&path, [io::Create]).unwrap();
- foreach i in uints.iter() {
+ for i in uints.iter() {
file.write_le_u64(*i);
}
}
// then read them back and check that they are the same
{
let file = io::file_reader(&path).unwrap();
- foreach i in uints.iter() {
+ for i in uints.iter() {
assert_eq!(file.read_le_u64(), *i);
}
}
// write the ints to the file
{
let file = io::file_writer(&path, [io::Create]).unwrap();
- foreach i in uints.iter() {
+ for i in uints.iter() {
file.write_be_u64(*i);
}
}
// then read them back and check that they are the same
{
let file = io::file_reader(&path).unwrap();
- foreach i in uints.iter() {
+ for i in uints.iter() {
assert_eq!(file.read_be_u64(), *i);
}
}
// write the ints to the file
{
let file = io::file_writer(&path, [io::Create]).unwrap();
- foreach i in ints.iter() {
+ for i in ints.iter() {
file.write_be_i32(*i);
}
}
// then read them back and check that they are the same
{
let file = io::file_reader(&path).unwrap();
- foreach i in ints.iter() {
+ for i in ints.iter() {
// this tests that the sign extension is working
// (comparing the values as i32 would not test this)
assert_eq!(file.read_be_int_n(4), *i as i64);