Skip to content

Commit

Permalink
Rename iterator.rs to iter.rs and expose it.
Browse files Browse the repository at this point in the history
  • Loading branch information
erickt committed Apr 26, 2015
1 parent cf38b8d commit eb9c860
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/iterator.rs → src/iter.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use std::io;

pub struct LineColIterator<Iter: Iterator<Item=io::Result<u8>>> {
rdr: Iter,
iter: Iter,
line: usize,
col: usize,
}

impl<Iter: Iterator<Item=io::Result<u8>>> LineColIterator<Iter> {
pub fn new(iter: Iter) -> LineColIterator<Iter> {
LineColIterator {
iter: iter,
line: 1,
col: 0,
rdr: iter,
}
}

Expand All @@ -34,7 +34,7 @@ impl<Iter: Iterator<Item=io::Result<u8>>> LineColIterator<Iter> {
impl<Iter: Iterator<Item=io::Result<u8>>> Iterator for LineColIterator<Iter> {
type Item = io::Result<u8>;
fn next(&mut self) -> Option<io::Result<u8>> {
match self.rdr.next() {
match self.iter.next() {
None => None,
Some(Ok(b'\n')) => {
self.line += 1;
Expand Down
3 changes: 2 additions & 1 deletion src/json/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::io;
use std::str;

use de;
use iter::LineColIterator;

use super::error::{Error, ErrorCode};
use iterator::LineColIterator;

pub struct Deserializer<Iter: Iterator<Item=io::Result<u8>>> {
rdr: LineColIterator<Iter>,
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ extern crate num;
pub use ser::{Serialize, Serializer};
pub use de::{Deserialize, Deserializer, Error};

pub mod ser;
pub mod bytes;
pub mod de;
pub mod iter;
pub mod json;
pub mod bytes;
mod iterator;
pub mod ser;

0 comments on commit eb9c860

Please sign in to comment.