Skip to content

Commit e200790

Browse files
committed
v0.4.0 (with doc attributes)
1 parent 8f47818 commit e200790

File tree

105 files changed

+381
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+381
-371
lines changed

godot-bindings/src/header_gen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub(crate) fn generate_rust_binding(in_h_path: &Path, out_rs_path: &Path) {
5757
});
5858
}
5959

60-
//#[cfg(target_os = "macos")]
60+
//#[cfg(target_os = "macos")] #[cfg_attr(published_docs, doc(cfg(target_os = "macos")))]
6161
fn configure_platform_specific(builder: bindgen::Builder) -> bindgen::Builder {
6262
// On macOS arm64 architecture, we currently get the following error. Tried using different LLVM versions.
6363
// Not clear if bindgen can be configured in a better way.

godot-bindings/src/import.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ pub const ALL_VERSIONS: &[(u8, u8, u8)] = &[
2727

2828
// [version-sync] [[
2929
// [line] #[cfg(feature = "api-$kebabVersion")]\npub use gdextension_api::version_$snakeVersion as prebuilt;
30-
#[cfg(feature = "api-4-2")]
30+
#[cfg(feature = "api-4-2")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-2")))]
3131
pub use gdextension_api::version_4_2 as prebuilt;
32-
#[cfg(feature = "api-4-2-1")]
32+
#[cfg(feature = "api-4-2-1")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-2-1")))]
3333
pub use gdextension_api::version_4_2_1 as prebuilt;
34-
#[cfg(feature = "api-4-2-2")]
34+
#[cfg(feature = "api-4-2-2")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-2-2")))]
3535
pub use gdextension_api::version_4_2_2 as prebuilt;
36-
#[cfg(feature = "api-4-3")]
36+
#[cfg(feature = "api-4-3")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-3")))]
3737
pub use gdextension_api::version_4_3 as prebuilt;
38-
#[cfg(feature = "api-4-4")]
38+
#[cfg(feature = "api-4-4")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-4")))]
3939
pub use gdextension_api::version_4_4 as prebuilt;
40-
#[cfg(feature = "api-4-5")]
40+
#[cfg(feature = "api-4-5")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-5")))]
4141
pub use gdextension_api::version_4_5 as prebuilt;
4242
// ]]
4343

godot-bindings/src/lib.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(published_docs, feature(doc_cfg))]
12
/*
23
* Copyright (c) godot-rust; Bromeon and contributors.
34
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -42,10 +43,10 @@ pub struct GodotVersion {
4243
// Custom mode: Regenerate all files
4344

4445
// This file is explicitly included in unit tests. Needs regex dependency.
45-
#[cfg(test)]
46+
#[cfg(test)] #[cfg_attr(published_docs, doc(cfg(test)))]
4647
mod godot_version;
4748

48-
#[cfg(feature = "api-custom")]
49+
#[cfg(feature = "api-custom")] #[cfg_attr(published_docs, doc(cfg(feature = "api-custom")))]
4950
#[path = ""]
5051
mod depend_on_custom {
5152
use std::borrow::Cow;
@@ -64,7 +65,7 @@ mod depend_on_custom {
6465
godot_exe::write_gdextension_headers(h_path, rs_path, false, watch);
6566
}
6667

67-
#[cfg(feature = "api-custom-extheader")]
68+
#[cfg(feature = "api-custom-extheader")] #[cfg_attr(published_docs, doc(cfg(feature = "api-custom-extheader")))]
6869
pub fn write_gdextension_headers_from_c(h_path: &Path, rs_path: &Path, watch: &mut StopWatch) {
6970
godot_exe::write_gdextension_headers(h_path, rs_path, true, watch);
7071
}
@@ -74,13 +75,13 @@ mod depend_on_custom {
7475
}
7576
}
7677

77-
#[cfg(feature = "api-custom")]
78+
#[cfg(feature = "api-custom")] #[cfg_attr(published_docs, doc(cfg(feature = "api-custom")))]
7879
pub use depend_on_custom::*;
7980

8081
// ----------------------------------------------------------------------------------------------------------------------------------------------
8182
// Custom mode: Generate all files based on user provided JSON.
8283

83-
#[cfg(feature = "api-custom-json")]
84+
#[cfg(feature = "api-custom-json")] #[cfg_attr(published_docs, doc(cfg(feature = "api-custom-json")))]
8485
#[path = ""]
8586
mod depend_on_custom_json {
8687
use std::borrow::Cow;
@@ -106,13 +107,13 @@ mod depend_on_custom_json {
106107
}
107108
}
108109

109-
#[cfg(feature = "api-custom-json")]
110+
#[cfg(feature = "api-custom-json")] #[cfg_attr(published_docs, doc(cfg(feature = "api-custom-json")))]
110111
pub use depend_on_custom_json::*;
111112

112113
// ----------------------------------------------------------------------------------------------------------------------------------------------
113114
// Prebuilt mode: Reuse existing files
114115

115-
#[cfg(not(any(feature = "api-custom", feature = "api-custom-json")))]
116+
#[cfg(not(any(feature = "api-custom", feature = "api-custom-json")))] #[cfg_attr(published_docs, doc(cfg(not(any(feature = "api-custom", feature = "api-custom-json")))))]
116117
#[path = ""]
117118
mod depend_on_prebuilt {
118119
use super::*;
@@ -154,7 +155,7 @@ mod depend_on_prebuilt {
154155
}
155156
}
156157

157-
#[cfg(not(any(feature = "api-custom", feature = "api-custom-json")))]
158+
#[cfg(not(any(feature = "api-custom", feature = "api-custom-json")))] #[cfg_attr(published_docs, doc(cfg(not(any(feature = "api-custom", feature = "api-custom-json")))))]
158159
pub use depend_on_prebuilt::*;
159160

160161
// ----------------------------------------------------------------------------------------------------------------------------------------------
@@ -218,7 +219,7 @@ pub fn emit_wasm_nothreads_cfg() {
218219

219220
// The environment variable for target family has a list of applicable families separated by commas.
220221
// For Emscripten in particular, this can be "unix,wasm". Therefore, to check for the Wasm target, we must check each item in the list.
221-
#[cfg(feature = "experimental-wasm-nothreads")]
222+
#[cfg(feature = "experimental-wasm-nothreads")] #[cfg_attr(published_docs, doc(cfg(feature = "experimental-wasm-nothreads")))]
222223
if std::env::var("CARGO_CFG_TARGET_FAMILY")
223224
.expect("target family environment variable")
224225
.split(',')

godot-cell/src/borrow_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ impl From<String> for BorrowStateErr {
298298
}
299299
}
300300

301-
#[cfg(all(test, feature = "proptest"))]
301+
#[cfg(all(test, feature = "proptest"))] #[cfg_attr(published_docs, doc(cfg(all(test, feature = "proptest"))))]
302302
mod proptests {
303303
use proptest::arbitrary::Arbitrary;
304304
use proptest::collection::vec;
@@ -635,7 +635,7 @@ mod proptests {
635635
}
636636
}
637637

638-
#[cfg(test)]
638+
#[cfg(test)] #[cfg_attr(published_docs, doc(cfg(test)))]
639639
mod test {
640640
use super::*;
641641

godot-cell/src/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<T> CellState<T> {
241241
}
242242
}
243243

244-
#[cfg(test)]
244+
#[cfg(test)] #[cfg_attr(published_docs, doc(cfg(test)))]
245245
mod test {
246246
use super::*;
247247

godot-cell/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(published_docs, feature(doc_cfg))]
12
/*
23
* Copyright (c) godot-rust; Bromeon and contributors.
34
* This Source Code Form is subject to the terms of the Mozilla Public

godot-codegen/src/generator/central_files.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ pub fn make_sys_central_code(api: &ExtensionApi) -> TokenStream {
2020
let [opaque_32bit, opaque_64bit] = make_opaque_types(api);
2121

2222
quote! {
23-
#[cfg(target_pointer_width = "32")]
23+
#[cfg(target_pointer_width = "32")] #[cfg_attr(published_docs, doc(cfg(target_pointer_width = "32")))]
2424
pub mod types {
2525
#(#opaque_32bit)*
2626
}
27-
#[cfg(target_pointer_width = "64")]
27+
#[cfg(target_pointer_width = "64")] #[cfg_attr(published_docs, doc(cfg(target_pointer_width = "64")))]
2828
pub mod types {
2929
#(#opaque_64bit)*
3030
}

godot-codegen/src/generator/classes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn make_class(class: &Class, ctx: &mut Context, view: &ApiView) -> GeneratedClas
125125
let (cfg_attributes, cfg_inner_attributes);
126126
if class.is_experimental {
127127
cfg_attributes = quote! {
128-
// #[cfg(feature = "experimental-godot-api")]
128+
// #[cfg(feature = "experimental-godot-api")] #[cfg_attr(published_docs, doc(cfg(feature = "experimental-godot-api")))]
129129
#[cfg_attr(published_docs, doc(cfg(feature = "experimental-godot-api")))]
130130
};
131131
cfg_inner_attributes = quote! {

godot-codegen/src/generator/method_tables.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl MethodInitGroup {
249249
}
250250
}
251251

252-
#[cfg(not(feature = "codegen-lazy-fptrs"))]
252+
#[cfg(not(feature = "codegen-lazy-fptrs"))] #[cfg_attr(published_docs, doc(cfg(not(feature = "codegen-lazy-fptrs"))))]
253253
fn function_name(&self) -> Ident {
254254
format_ident!("load_{}_methods", self.class_name)
255255
}
@@ -303,7 +303,7 @@ fn make_named_method_table(info: NamedMethodTable) -> TokenStream {
303303
}
304304
}
305305

306-
#[cfg(not(feature = "codegen-lazy-fptrs"))]
306+
#[cfg(not(feature = "codegen-lazy-fptrs"))] #[cfg_attr(published_docs, doc(cfg(not(feature = "codegen-lazy-fptrs"))))]
307307
fn make_method_table(info: IndexedMethodTable) -> TokenStream {
308308
let IndexedMethodTable {
309309
table_name,
@@ -415,7 +415,7 @@ fn make_method_table(info: IndexedMethodTable) -> TokenStream {
415415
}
416416
}
417417

418-
#[cfg(feature = "codegen-lazy-fptrs")]
418+
#[cfg(feature = "codegen-lazy-fptrs")] #[cfg_attr(published_docs, doc(cfg(feature = "codegen-lazy-fptrs")))]
419419
fn make_method_table(info: IndexedMethodTable) -> TokenStream {
420420
let IndexedMethodTable {
421421
table_name,

godot-codegen/src/generator/virtual_definition_consts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn make_virtual_hashes_for_class(class: &Class, ctx: &mut Context) -> TokenStrea
4141

4242
let constants = class.methods.iter().filter_map(|method| {
4343
let FnDirection::Virtual {
44-
#[cfg(since_api = "4.4")]
44+
#[cfg(since_api = "4.4")] #[cfg_attr(published_docs, doc(cfg(since_api = "4.4")))]
4545
hash,
4646
} = method.direction()
4747
else {
@@ -51,11 +51,11 @@ fn make_virtual_hashes_for_class(class: &Class, ctx: &mut Context) -> TokenStrea
5151
let rust_name = method.name_ident();
5252
let godot_name_str = method.godot_name();
5353

54-
#[cfg(since_api = "4.4")]
54+
#[cfg(since_api = "4.4")] #[cfg_attr(published_docs, doc(cfg(since_api = "4.4")))]
5555
let constant = quote! {
5656
pub const #rust_name: (&'static str, u32) = (#godot_name_str, #hash);
5757
};
58-
#[cfg(before_api = "4.4")]
58+
#[cfg(before_api = "4.4")] #[cfg_attr(published_docs, doc(cfg(before_api = "4.4")))]
5959
let constant = quote! {
6060
pub const #rust_name: &'static str = #godot_name_str;
6161
};

0 commit comments

Comments
 (0)