Skip to content

Commit a80ea14

Browse files
committed
v0.5.1 (with doc attributes)
1 parent 1b81822 commit a80ea14

116 files changed

Lines changed: 432 additions & 421 deletions

File tree

Some content is hidden

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

godot-bindings/src/header_gen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub(crate) fn generate_rust_binding(in_h_path: &Path, out_rs_path: &Path) {
6363
});
6464
}
6565

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

godot-bindings/src/import.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ pub const ALL_VERSIONS: &[(u8, u8, u8)] = &[
2626

2727
// [version-sync] [[
2828
// [line] #[cfg(feature = "api-$kebabVersion")]\npub use gdextension_api::version_$snakeVersion as prebuilt;
29-
#[cfg(feature = "api-4-2")]
29+
#[cfg(feature = "api-4-2")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-2")))]
3030
pub use gdextension_api::version_4_2 as prebuilt;
31-
#[cfg(feature = "api-4-3")]
31+
#[cfg(feature = "api-4-3")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-3")))]
3232
pub use gdextension_api::version_4_3 as prebuilt;
33-
#[cfg(feature = "api-4-4")]
33+
#[cfg(feature = "api-4-4")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-4")))]
3434
pub use gdextension_api::version_4_4 as prebuilt;
35-
#[cfg(feature = "api-4-5")]
35+
#[cfg(feature = "api-4-5")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-5")))]
3636
pub use gdextension_api::version_4_5 as prebuilt;
37-
#[cfg(feature = "api-4-6")]
37+
#[cfg(feature = "api-4-6")] #[cfg_attr(published_docs, doc(cfg(feature = "api-4-6")))]
3838
pub use gdextension_api::version_4_6 as prebuilt;
3939
// ]]
4040

godot-bindings/src/lib.rs

Lines changed: 13 additions & 12 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::*;
@@ -183,7 +184,7 @@ mod depend_on_prebuilt {
183184
}
184185
}
185186

186-
#[cfg(not(any(feature = "api-custom", feature = "api-custom-json")))]
187+
#[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")))))]
187188
pub use depend_on_prebuilt::*;
188189

189190
// ----------------------------------------------------------------------------------------------------------------------------------------------
@@ -247,7 +248,7 @@ pub fn emit_wasm_nothreads_cfg() {
247248

248249
// The environment variable for target family has a list of applicable families separated by commas.
249250
// For Emscripten in particular, this can be "unix,wasm". Therefore, to check for the Wasm target, we must check each item in the list.
250-
#[cfg(feature = "experimental-wasm-nothreads")]
251+
#[cfg(feature = "experimental-wasm-nothreads")] #[cfg_attr(published_docs, doc(cfg(feature = "experimental-wasm-nothreads")))]
251252
if std::env::var("CARGO_CFG_TARGET_FAMILY")
252253
.expect("target family environment variable")
253254
.split(',')
@@ -302,11 +303,11 @@ pub fn emit_safeguard_levels() {
302303
let mut safeguards_level = if cfg!(debug_assertions) { 2 } else { 1 };
303304

304305
// Override default level with Cargo feature, in dev/release profiles.
305-
#[cfg(debug_assertions)]
306+
#[cfg(debug_assertions)] #[cfg_attr(published_docs, doc(cfg(debug_assertions)))]
306307
if cfg!(feature = "safeguards-dev-balanced") {
307308
safeguards_level = 1;
308309
}
309-
#[cfg(not(debug_assertions))]
310+
#[cfg(not(debug_assertions))] #[cfg_attr(published_docs, doc(cfg(not(debug_assertions))))]
310311
if cfg!(feature = "safeguards-release-disengaged") {
311312
safeguards_level = 0;
312313
}
@@ -326,7 +327,7 @@ pub fn emit_safeguard_levels() {
326327
/// Try `new_name` env var first, fall back to `old_name` with a deprecation warning (only from `godot-codegen` build).
327328
/// The `once` static ensures the warning is emitted at most once per build.
328329
// TODO(v0.6): remove old names.
329-
#[cfg(any(feature = "api-custom", feature = "api-custom-json"))]
330+
#[cfg(any(feature = "api-custom", feature = "api-custom-json"))] #[cfg_attr(published_docs, doc(cfg(any(feature = "api-custom", feature = "api-custom-json"))))]
330331
pub(crate) fn env_var_or_deprecated(
331332
once: &'static std::sync::Once,
332333
new_name: &str,

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
@@ -276,7 +276,7 @@ impl<T> CellState<T> {
276276
}
277277
}
278278

279-
#[cfg(test)]
279+
#[cfg(test)] #[cfg_attr(published_docs, doc(cfg(test)))]
280280
mod test {
281281
use super::*;
282282

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-cell/tests/mock/blocking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl MyClass {
3636

3737
// ----------------------------------------------------------------------------------------------------------------------------------------------
3838

39-
// NOTE: We have to ignore each test individually, instead of using #[cfg(test)] on a module containing them, so that
39+
// NOTE: We have to ignore each test individually, instead of using #[cfg(test)] #[cfg_attr(published_docs, doc(cfg(test)))] on a module containing them, so that
4040
// `cargo test` still lists those tests, while indicating the reason why they were ignored.
4141

4242
/// Call each method from different threads, allowing them to run in parallel.

godot-codegen/src/conv/type_conversions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ fn to_rust_type_uncached(full_ty: &GodotTy, ctx: &mut Context) -> RustTy {
272272

273273
return RustTy::TypedArray {
274274
tokens: quote! { Array<#tokens> },
275-
#[cfg(not(feature = "codegen-full"))]
275+
#[cfg(not(feature = "codegen-full"))] #[cfg_attr(published_docs, doc(cfg(not(feature = "codegen-full"))))]
276276
elem_class: (!ctx.is_builtin(elem_ty)).then(|| elem_ty.to_string()),
277277
};
278278
} else if let Some(kv_ty) = ty.strip_prefix("typeddictionary::") {
@@ -288,9 +288,9 @@ fn to_rust_type_uncached(full_ty: &GodotTy, ctx: &mut Context) -> RustTy {
288288

289289
return RustTy::TypedDictionary {
290290
tokens: quote! { Dictionary<#key_tokens, #value_tokens> },
291-
#[cfg(not(feature = "codegen-full"))]
291+
#[cfg(not(feature = "codegen-full"))] #[cfg_attr(published_docs, doc(cfg(not(feature = "codegen-full"))))]
292292
key_class: (!ctx.is_builtin(key_ty)).then(|| key_ty.to_string()),
293-
#[cfg(not(feature = "codegen-full"))]
293+
#[cfg(not(feature = "codegen-full"))] #[cfg_attr(published_docs, doc(cfg(not(feature = "codegen-full"))))]
294294
value_class: (!ctx.is_builtin(value_ty)).then(|| value_ty.to_string()),
295295
};
296296
}
@@ -725,7 +725,7 @@ fn gdscript_to_rust_expr() {
725725
// Use arbitrary type if not specified -> should not be read
726726
let ty_dontcare = RustTy::TypedArray {
727727
tokens: TokenStream::new(),
728-
#[cfg(not(feature = "codegen-full"))]
728+
#[cfg(not(feature = "codegen-full"))] #[cfg_attr(published_docs, doc(cfg(not(feature = "codegen-full"))))]
729729
elem_class: None,
730730
};
731731
let ty = ty.unwrap_or(&ty_dontcare);

godot-codegen/src/generator/central_files.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ pub fn make_sys_central_code(api: &ExtensionApi) -> TokenStream {
2121
let godot_type_name_method = make_godot_type_name_method(api);
2222

2323
quote! {
24-
#[cfg(target_pointer_width = "32")]
24+
#[cfg(target_pointer_width = "32")] #[cfg_attr(published_docs, doc(cfg(target_pointer_width = "32")))]
2525
pub mod types {
2626
#(#opaque_32bit)*
2727
}
28-
#[cfg(target_pointer_width = "64")]
28+
#[cfg(target_pointer_width = "64")] #[cfg_attr(published_docs, doc(cfg(target_pointer_width = "64")))]
2929
pub mod types {
3030
#(#opaque_64bit)*
3131
}

godot-codegen/src/generator/classes.rs

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

0 commit comments

Comments
 (0)