Skip to content

Commit

Permalink
rustup
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntSushi committed Jan 28, 2015
1 parent b3b3337 commit a146b2b
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate csv;

use std::sync::mpsc::channel;
use std::io;
use std::old_io as io;
use std::thread::Thread;
use std::time::Duration;

Expand Down
5 changes: 3 additions & 2 deletions src/bench.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fmt::{Debug, Display};
use std::io::{self, ByRefReader};
use std::io::Reader as IoReader;
use std::old_io as io;
use std::old_io::ByRefReader;
use std::old_io::Reader as IoReader;
use stdtest::Bencher;

use Reader;
Expand Down
2 changes: 1 addition & 1 deletion src/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// method: `clear`. It resets the buffer to be empty (thereby losing any
// unread data).
use std::cmp;
use std::io::{Reader, Buffer, IoResult};
use std::old_io::{Reader, Buffer, IoResult};
use std::slice;

static DEFAULT_BUF_SIZE: usize = 1024 * 64;
Expand Down
4 changes: 2 additions & 2 deletions src/index/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(missing_docs)]

use std::error::FromError;
use std::io;
use std::old_io as io;

use {CsvResult, Error, Reader, NextField};

Expand Down Expand Up @@ -52,7 +52,7 @@ impl<R: io::Reader + io::Seek, I: io::Reader + io::Seek> Indexed<R, I> {
pub fn create<R: io::Reader + io::Seek, W: io::Writer>
(mut csv_rdr: Reader<R>, mut idx_wtr: W) -> CsvResult<()> {
// Seek to the beginning so that we get everything.
try!(csv_rdr.seek(0, ::std::io::SeekSet));
try!(csv_rdr.seek(0, io::SeekSet));
let mut count = 0u64;
while !csv_rdr.done() {
try!(idx_wtr.write_be_u64(csv_rdr.byte_offset()));
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ extern crate "rustc-serialize" as rustc_serialize;
use std::error::Error as StdError;
use std::error::FromError;
use std::fmt;
use std::io;
use std::old_io as io;

pub use bytestr::{BorrowBytes, ByteString, IntoVector, StrAllocating};
pub use encoder::Encoded;
Expand Down
11 changes: 6 additions & 5 deletions src/reader.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::io::{self, MemReader};
use std::old_io as io;

use rustc_serialize::Decodable;

Expand Down Expand Up @@ -167,15 +167,16 @@ impl Reader<io::IoResult<io::File>> {
}
}

impl Reader<MemReader> {
impl Reader<io::MemReader> {
/// Creates a CSV reader for an in memory string buffer.
pub fn from_string<S>(s: S) -> Reader<MemReader> where S: StrAllocating {
pub fn from_string<S>(s: S) -> Reader<io::MemReader>
where S: StrAllocating {
Reader::from_bytes(s.into_str().into_bytes())
}

/// Creates a CSV reader for an in memory buffer of bytes.
pub fn from_bytes<V: IntoVector<u8>>(bytes: V) -> Reader<MemReader> {
Reader::from_reader(MemReader::new(bytes.into_vec()))
pub fn from_bytes<V: IntoVector<u8>>(bytes: V) -> Reader<io::MemReader> {
Reader::from_reader(io::MemReader::new(bytes.into_vec()))
}
}

Expand Down
9 changes: 4 additions & 5 deletions src/test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::borrow::ToOwned;
use std::io::ByRefReader;
use std::io::Reader as IoReader;
use std::io::Writer as IoWriter;
use std::old_io as io;
use std::old_io::ByRefReader;
use std::old_io::Reader as IoReader;
use std::old_io::Writer as IoWriter;
use {
Reader, Writer, ByteString, CsvResult,
IntoVector, RecordTerminator, QuoteStyle,
Expand Down Expand Up @@ -391,8 +392,6 @@ fn invalid_utf8() {

#[test]
fn seeking() {
use std::io;

let data = "1,2\n3,4\n5,6\n";
let mut buf = io::MemReader::new(data.as_bytes().to_vec());

Expand Down
4 changes: 2 additions & 2 deletions src/writer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::error::FromError;
use std::io;
use std::old_io as io;
use std::str;

use rustc_serialize::Encodable;
Expand Down Expand Up @@ -357,7 +357,7 @@ impl<W: io::Writer> Writer<W> {
}

fn w_bytes(&mut self, s: &[u8]) -> CsvResult<()> {
self.buf.write(s).map_err(Error::Io)
self.buf.write_all(s).map_err(Error::Io)
}

fn w_user_bytes(&mut self, s: &[u8]) -> CsvResult<()> {
Expand Down

0 comments on commit a146b2b

Please sign in to comment.