fn add_prelude(options: &Options, writer: &CodeWriter) -> anyhow::Result<()> {
    emit!(writer, "\n// ** prelude from {}\n\n", &options.prelude_path);
    let content = if options.prelude_path == INLINE_PRELUDE {
        debug!("using inline prelude");
        String::from_utf8_lossy(DEFAULT_PRELUDE).to_string()
    } else {
        debug!("using prelude at {}", &options.prelude_path);
        fs::read_to_string(&options.prelude_path)?
    };
    let mut handlebars = Handlebars::new();
    handlebars.register_helper(
        "stratified",
        Box::new(StratificationHelper::new(
            options.backend.stratification_depth,
        )),
    );
    let expanded_content = handlebars.render_template(&content, &options)?;
    emitln!(writer, &expanded_content);
    Ok(())
}
/// Adds the prelude to the generated output.
Adds the prelude to the generated output.
Adds the prelude to the generated output .
fn add_prelude(options: &Options, writer: &CodeWriter) -> anyhow::Result<()> {
    emit!(writer, "\n// ** prelude from {}\n\n", &options.prelude_path);
    let content = if options.prelude_path == INLINE_PRELUDE {
        debug!("using inline prelude");
        String::from_utf8_lossy(DEFAULT_PRELUDE).to_string()
    } else {
        debug!("using prelude at {}", &options.prelude_path);
        fs::read_to_string(&options.prelude_path)?
    };
    let mut handlebars = Handlebars::new();
    handlebars.register_helper(
        "stratified",
        Box::new(StratificationHelper::new(
            options.backend.stratification_depth,
        )),
    );
    let expanded_content = handlebars.render_template(&content, &options)?;
    emitln!(writer, &expanded_content);
    Ok(())
}
fn add_prelude ( options : & Options , writer : & CodeWriter ) -> anyhow :: Result < ( ) > { emit ! ( writer " \n \n \n " options prelude_path ) ; let content = if options . prelude_path == INLINE_PRELUDE { debug ! ( " " ) ; String :: from_utf8_lossy ( DEFAULT_PRELUDE ) . to_string ( ) } else { debug ! ( " " options prelude_path ) ; fs :: read_to_string ( & options . prelude_path ) ? } ; let mut handlebars = Handlebars :: new ( ) ; handlebars . register_helper ( " " , Box :: new ( StratificationHelper :: new ( options . backend . stratification_depth , ) ) , ) ; let expanded_content = handlebars . render_template ( & content , & options ) ? ; emitln ! ( writer expanded_content ) ; Ok ( ( ) ) }
Adds the prelude to the generated output.
Adds the prelude to the generated output .
options
&Options
writer
&CodeWriter