[go: up one dir, main page]

cxx 0.1.0

Safe interop between Rust and C++
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
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)
    }
}