rust_source_bundler 0.2.2

Library to bundle local Rust library source files into a single file
Documentation
mod bundler;

use bundler::Bundler;

use std::path::PathBuf;

use quote::ToTokens;

use rust_format::{
    Formatter,
    RustFmt,
};

use anyhow::Result;

pub fn bundle_source(root_dir: impl Into<PathBuf>, filename: impl Into<String>) -> Result<String> {
    let ast = Bundler::new(root_dir.into()).bundle_to_ast(filename.into())?;

    let token_stream = ast.into_token_stream();

    let generated_code = RustFmt::default().format_tokens(token_stream)?;

    return Ok(generated_code);
}