mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-24 10:03:39 +00:00
14 lines
451 B
Rust
14 lines
451 B
Rust
static HEADER: &str = include_str!("include/cxxbridge.h");
|
|
|
|
pub fn get(guard: &str) -> &'static str {
|
|
let ifndef = format!("#ifndef {}\n", guard);
|
|
let endif = format!("#endif // {}\n", guard);
|
|
let begin = HEADER.find(&ifndef);
|
|
let end = HEADER.find(&endif);
|
|
if let (Some(begin), Some(end)) = (begin, end) {
|
|
&HEADER[begin..end + endif.len()]
|
|
} else {
|
|
panic!("not found in cxxbridge.h header: {}", guard)
|
|
}
|
|
}
|