Skip to content

Commit 331c76e

Browse files
committed
refactor: reorganize modules
1 parent 9e0db6c commit 331c76e

File tree

14 files changed

+2115
-2111
lines changed

14 files changed

+2115
-2111
lines changed

examples/parser_file_in_file_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{
1010
io::{Read, Write},
1111
};
1212

13-
use bencode2json::parsers::BencodeParser;
13+
use bencode2json::parsers::generators::json::BencodeParser;
1414
use clap::{Arg, Command};
1515

1616
fn main() {

examples/parser_stdin_stdout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! It prints "spam".
88
use std::io;
99

10-
use bencode2json::parsers::BencodeParser;
10+
use bencode2json::parsers::generators::json::BencodeParser;
1111

1212
fn main() {
1313
let input = Box::new(io::stdin());

examples/parser_string_in_string_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::BencodeParser;
8+
use bencode2json::parsers::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = "4:spam".to_string();

examples/parser_string_in_vec_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::BencodeParser;
8+
use bencode2json::parsers::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = "4:spam".to_string();

examples/parser_vec_in_string_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::BencodeParser;
8+
use bencode2json::parsers::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = b"4:spam".to_vec();

examples/parser_vec_in_vec_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::BencodeParser;
8+
use bencode2json::parsers::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = b"4:spam".to_vec();

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
//!
3535
//! > __NOTICE__: In the context of this lib, parser is a function that takes an input
3636
//! > containing bencoded data and produces a JSON output (raw bytes or UTF-8 string).
37-
use parsers::{error::Error, BencodeParser};
37+
use parsers::{error::Error, generators::json::BencodeParser};
3838

3939
pub mod parsers;
4040
pub mod rw;

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! ```text
1414
//! cargo run -- -i ./tests/fixtures/sample.bencode -o output.json
1515
//! ```
16-
use bencode2json::parsers::BencodeParser;
16+
use bencode2json::parsers::generators::json::BencodeParser;
1717
use clap::{Arg, Command};
1818
use std::fs::File;
1919
use std::io::{self, Read, Write};

src/parsers/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use thiserror::Error;
99

1010
use crate::rw;
1111

12-
use super::BencodeType;
12+
use super::generators::BencodeType;
1313

1414
/// Errors that can occur while parsing a bencoded value.
1515
#[derive(Debug, Error)]
@@ -121,7 +121,7 @@ pub enum Error {
121121
NoMatchingStartForListOrDictEnd(ReadContext, WriteContext),
122122
}
123123

124-
/// The reader context when the error ocurred.
124+
/// The reader context when the error occurred.
125125
#[derive(Debug)]
126126
pub struct ReadContext {
127127
/// The read byte that caused the error if any.
@@ -157,7 +157,7 @@ impl fmt::Display for ReadContext {
157157
}
158158
}
159159

160-
/// The writer context when the error ocurred.
160+
/// The writer context when the error occurred.
161161
#[derive(Debug)]
162162
pub struct WriteContext {
163163
/// The written byte that caused the error if any.

0 commit comments

Comments
 (0)