Rename iterator.rs to iter.rs and expose it.
This commit is contained in:
parent
cf38b8dae5
commit
eb9c860cb4
@ -1,7 +1,7 @@
|
||||
use std::io;
|
||||
|
||||
pub struct LineColIterator<Iter: Iterator<Item=io::Result<u8>>> {
|
||||
rdr: Iter,
|
||||
iter: Iter,
|
||||
line: usize,
|
||||
col: usize,
|
||||
}
|
||||
@ -9,9 +9,9 @@ pub struct LineColIterator<Iter: Iterator<Item=io::Result<u8>>> {
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
@ -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>,
|
||||
|
@ -12,8 +12,8 @@ extern crate num;
|
||||
pub use ser::{Serialize, Serializer};
|
||||
pub use de::{Deserialize, Deserializer, Error};
|
||||
|
||||
pub mod ser;
|
||||
pub mod de;
|
||||
pub mod json;
|
||||
pub mod bytes;
|
||||
mod iterator;
|
||||
pub mod de;
|
||||
pub mod iter;
|
||||
pub mod json;
|
||||
pub mod ser;
|
||||
|
Loading…
Reference in New Issue
Block a user