Skip to content

Commit

Permalink
Expose cxx_gen::HEADER as a static &'static str
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 16, 2020
1 parent c904f8a commit 0e01d64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions gen/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ mod gen;
mod syntax;

pub use crate::error::Error;
pub use crate::gen::include::HEADER;
pub use crate::gen::{GeneratedCode, Opt};
use proc_macro2::TokenStream;
use gen::include::HEADER;

/// Generate C++ bindings code from a Rust token stream. This should be a Rust
/// token stream which somewhere contains a `#[cxx::bridge] mod {}`.
Expand All @@ -32,8 +32,3 @@ pub fn generate_header_and_cc(rust_source: TokenStream, opt: &Opt) -> Result<Gen
.map_err(Error::from)?;
gen::generate(syntax, opt).map_err(Error::from)
}

/// Returns the complete contents of the cxx.h header.
pub fn get_cxx_header_contents() -> &'static str {
HEADER
}
1 change: 1 addition & 0 deletions gen/src/include.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::gen::out::OutFile;
use std::fmt::{self, Display};

/// The complete contents of the "rust/cxx.h" header.
pub static HEADER: &str = include_str!("include/cxx.h");

pub(super) fn write(out: &mut OutFile, needed: bool, guard: &str) {
Expand Down

0 comments on commit 0e01d64

Please sign in to comment.