structx 0.1.3

Simulating anonymous struct and named arguments in Rust.
Documentation
use inwelling::*;

use std::{
    env,
    path::PathBuf,
};

fn main() {
    let mut output = inwelling( Opts{ watch_manifest: true, watch_rs_files: true, dump_rs_paths: true })
        .sections
        .into_iter()
        .fold( String::from( "structx_derive::scan_structx_from_source_files!{\n" ), |mut output, section| {
            section
                .rs_paths
                .unwrap()
                .iter()
                .for_each( |rs_path| {
                    let rs_path = rs_path.to_str().unwrap();

                    if cfg!( windows ) {
                        output.push_str( &format!( "    \"{}\",\n", rs_path.replace( "\\", "\\\\" )));
                    } else {
                        output.push_str( &format!( "    \"{}\",\n", rs_path ));
                    }
                });
            output
        });
    output.push( '}' );

    let out_path = PathBuf::from( env::var( "OUT_DIR" )
        .expect( "$OUT_DIR should exist." ));
    std::fs::write( out_path.join( "bindings.rs" ), output )
        .expect( "bindings.rs should be generated." );
}