doubter_impl/
lib.rs

1extern crate bytecount;
2extern crate glob;
3extern crate proc_macro;
4extern crate proc_macro2;
5extern crate pulldown_cmark;
6#[macro_use]
7extern crate quote;
8#[macro_use]
9extern crate syn;
10
11mod config;
12mod extract;
13mod render;
14mod tree;
15mod util;
16
17// not a public API.
18#[doc(hidden)]
19pub mod private {
20    pub use config::Config;
21    pub use render::RenderContext;
22
23    use proc_macro2::TokenStream;
24    use syn;
25
26    pub fn parse_config<T>(input: T) -> syn::parse::Result<Config>
27    where
28        T: Into<TokenStream>,
29    {
30        syn::parse2(input.into())
31    }
32}
33
34pub mod public {
35    use std::io;
36
37    use render::RenderContext;
38
39    pub use config::{Config, Mode};
40
41    /// Generates a code from the given configuration.
42    ///
43    /// This function is typically used from the inside of `build.rs`,
44    /// in order to avoid constraints on macro calls.
45    pub fn generate_doc_tests<W>(config: Config, writer: &mut W) -> io::Result<()>
46    where
47        W: io::Write,
48    {
49        RenderContext::init(config)?.write(writer)
50    }
51}