diff --git a/README.md b/README.md index 7d18059..65d240c 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,7 @@ The library is split into 2 main components: The lexer scans the document and returns a `Vec` which represent the RTF file in a code-understandable manner. These tokens can then be passed to the parser to transcript it to a real document : `RtfDocument`. ```rust -use rtf_parser::lexer::Lexer; -use rtf_parser::tokens::Token; -use rtf_parser::parser::Parser; -use rtf_parser::document::RtfDocument; +use rtf_parser::{ Lexer, Token, Parser, RtfDocument }; fn main() -> Result<(), Box> { let tokens: Vec = Lexer::scan("")?; @@ -40,7 +37,7 @@ fn main() -> Result<(), Box> { or in a more concise way : ```rust -use rtf_parser::document::RtfDocument; +use rtf_parser::RtfDocument; fn main() -> Result<(), Box> { let doc: RtfDocument = RtfDocument::try_from("")?; @@ -104,8 +101,8 @@ fn main() -> Result<(), Box> { ## Examples A complete example of rtf parsing is presented below : ```rust -use rtf_parser::lexer::Lexer; -use rtf_parser::parser::Parser; +use rtf_parser::Lexer; +use rtf_parser::Parser; fn main() -> Result<(), Box> { let rtf_text = r#"{ \rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard Voici du texte en {\b gras}.\par }"#; diff --git a/examples/bench.rs b/examples/bench.rs index d3cead9..bea3710 100644 --- a/examples/bench.rs +++ b/examples/bench.rs @@ -1,8 +1,6 @@ use std::time::Instant; -use rtf_parser::header::StyleSheet; -use rtf_parser::lexer::Lexer; -use rtf_parser::parser::Parser; +use rtf_parser::{Lexer, Parser, StyleSheet}; fn main() { let start = Instant::now(); diff --git a/examples/load_file.rs b/examples/load_file.rs index b144ab2..0763063 100644 --- a/examples/load_file.rs +++ b/examples/load_file.rs @@ -1,7 +1,5 @@ extern crate rtf_parser; -use rtf_parser::header::StyleSheet; -use rtf_parser::lexer::Lexer; -use rtf_parser::parser::Parser; +use rtf_parser::{Lexer, Parser, StyleSheet}; fn main() { let rtf_text = include_str!("../resources/tests/file-sample_500kB.rtf"); diff --git a/src/lib.rs b/src/lib.rs index 7b4c213..58065cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,3 +13,11 @@ pub mod paragraph; pub mod parser; pub mod tokens; mod utils; + +// Re-export all the symbols to the global rtf-parser namespace +pub use document::*; +pub use header::*; +pub use lexer::*; +pub use paragraph::*; +pub use parser::*; +pub use tokens::*;