Skip to content

Commit

Permalink
Use vendored generated.rs for docs.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
oberrich committed Apr 10, 2024
1 parent 033fe39 commit 3e38ab1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ description = "Rust bindings to the System Informer's (formerly known as Process
# exclude = ["deps"]

[features]
default = ["docsrs"]
docsrs = []
default = []

[package.metadata.docs.rs]
features = ["docsrs"]
Expand Down
2 changes: 1 addition & 1 deletion src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl BindgenConfig {

fn main() {
if cfg!(feature = "docsrs") {
println!("Skipping regeneration of bindings for docs.");
println!("Skipping regeneration of bindings for docs.rs.");
return;
}

Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
non_camel_case_types,
non_upper_case_globals
)]
#[cfg(not(feature="docsrs"))]
pub mod ffi {
// use vendored `generated.rs` for docs.rs
#[cfg(feature="docsrs")]
include!("ffi/generated.rs");

#[cfg(not(feature="docsrs"))]
include!(concat!(env!("OUT_DIR"), "\\generated.rs"));

Expand Down

0 comments on commit 3e38ab1

Please sign in to comment.