[src]
pub fn new(writer: Write, delimiter: char = ',', comment: char? = nil): Writer {
return _csv.Writer.new(_create_native_write(writer), delimiter, comment) as Writer;
}
Creates a new CSV writer.
[src]
pub fn new(writer: Write, delimiter: char = ',', comment: char? = nil): Writer {
return _csv.Writer.new(_create_native_write(writer), delimiter, comment) as Writer;
}
Creates a new CSV writer.
Creates a new CSV writer.
The output
argument is a std.io.Write
of destination to write the CSV data to.
The delimiter
used to separate fields, default: ,
.
Example
use std.io;
use csv.Writer;
let writer = Writer.new(io.stdout(), delimiter: '|');
[src]
pub fn write(self, record: Record) throws IoError {
try (self as _csv.Writer).write(record as _csv.Record);
}
Write a record to the CSV output.
[src]
pub fn write(self, record: Record) throws IoError {
try (self as _csv.Writer).write(record as _csv.Record);
}
Write a record to the CSV output.
Write a record to the CSV output.
The fields
argument is a list of Strings to write as a record.
Example
use std.io;
use csv.{Writer, Record};
fn main() throws {
let data = io.Bytes.new();
let writer = Writer.new(data);
let record = Record.new("foo", "bar", "baz");
try writer.write(record);
try writer.flush();
assert_eq data, b"foo,bar,baz\n";
}
write_fields
pub fn write_fields(self, fields: ..string) throws IoError
[src]
pub fn write_fields(self, fields: ..string) throws IoError {
try self.write(Record.new(..fields));
}
Write a record to the CSV output.
write_fields
pub fn write_fields(self, fields: ..string) throws IoError
[src]
pub fn write_fields(self, fields: ..string) throws IoError {
try self.write(Record.new(..fields));
}
Write a record to the CSV output.
Write a record to the CSV output.
The fields
argument is a list of Strings to write as a record.
Example
use std.io;
use csv.{Writer, Record};
fn main() throws {
let data = io.Bytes.new();
let writer = Writer.new(data);
try writer.write_fields("foo", "bar", "baz");
try writer.flush();
assert_eq data, b"foo,bar,baz\n";
}
[src]
pub fn flush(self) throws IoError {
try (self as _csv.Writer).flush();
}
Flush the contents of the internal buffer to the underlying writer.
[src]
pub fn flush(self) throws IoError {
try (self as _csv.Writer).flush();
}
Flush the contents of the internal buffer to the underlying writer.
Flush the contents of the internal buffer to the underlying writer.
If there was a problem writing to the underlying writer, then an error is returned. If you not call this method, the contents of the internal buffer may not be written to the underlying writer.