genco::lang::c

Function include

Source
pub fn include<M, N>(path: M, item: N) -> Import
where M: Into<ItemStr>, N: Into<ItemStr>,
Expand description

Include an item declared in a local C header file such as #include "foo/bar.h"

ยงExamples

use genco::prelude::*;

let fizzbuzz = c::include("foo/bar.h", "fizzbuzz");

let fizzbuzz_toks = quote! {
    $fizzbuzz
};

assert_eq!(
    vec![
       "#include \"foo/bar.h\"",
       "",
       "fizzbuzz",
    ],
    fizzbuzz_toks.to_file_vec()?
);