Hi,
I am getting the following errors:

$ rustc csv_create.rs
csv_create.rs:17:1: 17:14 error: attempted access of field write_str on
type core::io::writer, but no public field or method with that name was
found
csv_create.rs:17        rdr.write_str("aaa, bbb,ccc ,
ddd,eee,fff,ggg,hhh,iii,jjj,kkk,lll,mmm,nnn\n");
                                  ^~~~~~~~~~~~~
csv_create.rs:17:1: 17:78 error: mismatched types: expected function or
native function but found _|_
csv_create.rs:17        rdr.write_str("aaa, bbb,ccc ,
ddd,eee,fff,ggg,hhh,iii,jjj,kkk,lll,mmm,nnn\n");

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

with the following code:

import io::reader_util;
import vec::map;

fn main(args: [str]) {

    let r = io::file_writer("csv.csv" , [io::create, io::truncate]); // r
is result<reader, err_str>
    if result::is_failure(r) {
        fail result::get_err(r);
    }

    let rdr = result::get(r);

    let count = 0;
    while true {

        if count == 4000000 { break; }
        rdr.write_str("aaa, bbb,ccc ,
ddd,eee,fff,ggg,hhh,iii,jjj,kkk,lll,mmm,nnn\n");
        count += 1;
    }
}

What did I do wrong and would it possible to rewrite the while loop with
for loop?

Thank you in advance.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to