Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify module structure (redundant re-exports) #788

Merged
merged 17 commits into from
Oct 13, 2021

Conversation

Bromeon
Copy link
Member

@Bromeon Bromeon commented Sep 27, 2021

Simplifies the module structure and closes #771.

Changes

TLDR:

  • Every symbol lives in exactly one module (+ optionally the prelude)
  • No symbols except modules at gdnative crate root (not even macros)
  • Some module renamings for clarification
  • No semantic changes -- may break imports however

Detailed list:

  • Change gdnative::object
    • Now official home for Ref, TRef etc.
    • Move several verifying traits: object -> object::bounds
    • Move/rename gdnative::thread_access -> gdnative::object::ownership
    • Move/rename gdnative::ref_kind -> gdnative::object::memory
  • Change gdnative::core_types
    • No more nested modules
    • Move gdnative::GodotError to gdnative::object::GodotError
  • Change gdnative::nativescript
    • Rename init -> export
    • Rename profiling -> profiler
    • export and user_data no longer re-exported to nativescript
    • class now private, symbols re-exported to nativescript
    • Macro profile_sig! now in profiler
    • Improve documentation + fix doc tests
  • Add gdnative::macros
    • replaces crate root for godot_init! etc.
  • Add gdnative::derive
    • contains derive macros and macro attributes
  • Document feature flags in lib.rs and Variant

Things not (yet) done

Those could be discussed in separate PRs.

  • Changes to the prelude
  • Clean up the modules inside gdnative::api
    The issue here is that the modules under api are used for grouping related symbols. For example, api::node has 3 structs Node, DuplicateFlags and PauseMode. In C++, they would be represented as enum/struct inside a class Node, however Rust does not support nested types in struct, hence the module is used. An alternative would be to remove api::Node and just use api::node::Node, but this is less ergonomic.
  • Some very deep nestings, such as gdnative::nativescript::export::property::hint::ArrayHint

@Bromeon Bromeon added c: core Component: core (mod core_types, object, log, init, ...) c: bindings Component: GDNative bindings (mod api) labels Sep 27, 2021
@Bromeon Bromeon added this to the v0.10 milestone Sep 27, 2021
@Bromeon Bromeon changed the title 771/redundant reexports Simplify module structure (redundant re-exports) Sep 27, 2021
Copy link
Contributor

@jacobsky jacobsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the hard work. This looks like a really good start to the changes! I've left a bit of my thoughts as well as some confirmation points. I think I understand where we are going with the changes. It should make it a bit easier to validate.

Have you tried generating the docs with this PR?

@@ -53,12 +53,12 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this change is to remove the workaround that was previously put in place. To confirm, the reason for this change is that the workaround is no longer needed, correct? If so, I think removing all the references as well as the comment may be the best option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, this is still a WIP and I need to first confirm that the workaround is no longer needed (at least on stable Rust).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built the docs from your branch and currently it looks like regardless of what we do we're still getting the multiple module paths when searching the docs.

Your changes: image
https://godot-rust.github.io/docs/gdnative/ image

@@ -82,3 +82,6 @@ impl std::fmt::Display for GodotError {
}

impl std::error::Error for GodotError {}

/// Result type with [GodotError]
pub type GodotResult = Result<(), GodotError>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it the rationale behind moving GodotResult to core_types is that it's the Rust-side implementation for the Godot Error codes, correct? If so, I like this change. It makes a lot of sense to put GodotResult here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and to be honest I didn't know a module that would fit better. But your reason sounds more sophisticated 😅

@@ -1,11 +1,16 @@
//! Types that represent core-datatypes of Godot.
//! Types that represent core data types of Godot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming, most of the changes in here are for organizational purposes, correct? If so, looks good!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I don't want to introduce any semantic changes in this PR.
There might be breaking changes due to new module structure, but functionality-wise, we should not lose anything.

@@ -43,7 +44,7 @@ pub use rid::*;
pub use string::*;
pub use string_array::*;
pub use transform2d::*;
pub use typed_array::{Element, TypedArray};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Element is intended to be an internal implementation detail? Or was this initially made public (in the past) by mistake?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered the same thing. A lot of stuff is public and sometimes even appears in the documentation, though I don't think anyone uses it. Probably we should locate some of those cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the Element re-export in the serde PR. It's not technically needed anymore, but it was discussed here: #743 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah interesting, thanks!

Element is documented at the moment, and it's nice for the user to see which element types are supported. If we want to keep the core_types::typed_array module hidden, we should also keep re-exporting Element, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could potentially be useful to allow users to implement their own traits generically for all TypedArrays.

@@ -56,7 +55,7 @@ pub mod private;
//

pub use init::{InitializeInfo, TerminateInfo};
pub use new_ref::NewRef;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good change. It's probably a good idea to keep all the similar stuff together, as such merging new_ref and object is a really good change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, my idea is that all helper types related to object and reference handling would become part of the object module. I also moved object.rs to object/mod.rs, which contains the large part of the symbols.

Copy link
Member Author

@Bromeon Bromeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! From your feedback, there are still these tasks left (in addition to those in the initial post):

  • what needs to be public -- Element and possibly others
  • #[doc(inline)] workaround in gdnative/src/lib.rs
  • what exactly belongs to object module
  • check resulting documentation after changes

@@ -53,12 +53,12 @@

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, this is still a WIP and I need to first confirm that the workaround is no longer needed (at least on stable Rust).

@@ -56,7 +55,7 @@ pub mod private;
//

pub use init::{InitializeInfo, TerminateInfo};
pub use new_ref::NewRef;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, my idea is that all helper types related to object and reference handling would become part of the object module. I also moved object.rs to object/mod.rs, which contains the large part of the symbols.

@@ -1,11 +1,16 @@
//! Types that represent core-datatypes of Godot.
//! Types that represent core data types of Godot.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I don't want to introduce any semantic changes in this PR.
There might be breaking changes due to new module structure, but functionality-wise, we should not lose anything.

@@ -43,7 +44,7 @@ pub use rid::*;
pub use string::*;
pub use string_array::*;
pub use transform2d::*;
pub use typed_array::{Element, TypedArray};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered the same thing. A lot of stuff is public and sometimes even appears in the documentation, though I don't think anyone uses it. Probably we should locate some of those cases.

@jacobsky
Copy link
Contributor

@Bromeon I'm glad to help. That tasklist sounds correct. Most of it is just checking my assumptions about the changes.

I think double-checking whether anything else belongs in object would be a great idea. Then we can keep the breaking changes to just 0.10.0 😄

I am curious if newer versions of cargo doc have removed the need for the workaround. Or perhaps we can just kind of live with the issue? (I'm not actually sure what was actually being fixed with that change). 😅

@Bromeon Bromeon force-pushed the 771/redundant-reexports branch 5 times, most recently from 3295c67 to a308bc7 Compare October 4, 2021 22:57
@Bromeon
Copy link
Member Author

Bromeon commented Oct 4, 2021

Changes so far:

  • Avoid many duplicate module paths for core_type
  • Clean up most of gdnative::object
    • Move Ref, TRef etc. from top-level namespace
    • Rename thread_access -> ownership (but leaving symbol names for now)
    • Rename ref_kind -> memory
    • Add object::bounds with all the implementation details, so they don't pollute object
  • Move derive macros from top-level to gdnative::derive

The above are not yet 100% done, needs some double-checking.

Tasks left for consideration:

  • Move Instance/RefInstance from nativescript to object, so they're next to Ref/TRef.
  • Check if nativescript can be organized better -- and is its name helpful?
  • What do do with global macros like godot_init, godot_error etc.
  • Lots of symbols are #[doc(hidden)] but maybe part of the API; others are implementation details but public.
    Hide symbols which the user doesn't get into contact with.
  • Decide if deprecation of a handful symbols (like gdnative::Ref, gdnative::NativeScript) is useful, or not.
    For non-type symbols, this would possibly require code duplication...
  • Go through prelude symbols and check if their inclusion is justified

Copy link
Contributor

@jacobsky jacobsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look great. I like the new module structure. I think that we can continue down this route.

Regarding your proposals for additional changes,

Tasks left for consideration:

Move Instance/RefInstance from nativescript to object, so they're next to Ref/TRef.

I am 100% in favor of this. Ref/TRef or Instance/RefInstance should be in the same module as they are super closely related.

Check if nativescript can be organized better -- and is its name helpful?

I think nativescript is in a solid enough spot. I'm not sure that I would move anything else out of there.

What do do with global macros like godot_init, godot_error etc.

These might be a good candidate for a macros module. (Not sure 100% where they are currently)

Lots of symbols are #[doc(hidden)] but maybe part of the API; others are implementation details but public.
Hide symbols which the user doesn't get into contact with.
Decide if deprecation of a handful symbols (like gdnative::Ref, gdnative::NativeScript) is useful, or not.

Both of the above are great ideas.
Is this referring only to the re-export? If so, I think this would be a good idea. I think we generally want users to do one of two things when interacting with the API.

a. Only make use of the prelude (use gdnative::prelude::*) which should contain everything necessary for normal use.
b. Use the full canonical name, not use use gdnative::{thing}

For non-type symbols, this would possibly require code duplication...

Which non-type symbols are you specifically considering here? Some code duplication is inevitable, but we could probably manage it by clever use of the include! macro.

Go through prelude symbols and check if their inclusion is justified

This sounds like a good idea, if you would like to ping me on a review, I'd be happy to run through the list and give my thoughts on each item.

@Bromeon
Copy link
Member Author

Bromeon commented Oct 5, 2021

Thanks a lot for your feedback!


What do do with global macros like godot_init, godot_error etc.

These might be a good candidate for a macros module. (Not sure 100% where they are currently)

Currently they're in top-level gdnative module. I agree a nested module might make sense. I don't really see them fit in one of object, nativescript, api or core_types.

Maybe godot_init! can be re-exported in the prelude. The others don't seem very common.


Lots of symbols are #[doc(hidden)] but maybe part of the API; others are implementation details but public.
Hide symbols which the user doesn't get into contact with.
Decide if deprecation of a handful symbols (like gdnative::Ref, gdnative::NativeScript) is useful, or not.

Both of the above are great ideas. Is this referring only to the re-export?

Yes, I wouldn't change/deprecate any functionality as part of this PR, just module names.


For non-type symbols, this would possibly require code duplication...

Which non-type symbols are you specifically considering here? Some code duplication is inevitable, but we could probably manage it by clever use of the include! macro.

Macros/macro attributes like gdnative::NativeClass, gdnative::methods or traits like gdnative::NewRef, for example.


Go through prelude symbols and check if their inclusion is justified

This sounds like a good idea, if you would like to ping me on a review, I'd be happy to run through the list and give my thoughts on each item.

If you have the time, that would be nice!

All the bindings types should definitely stay there, as well as the core types. Probably makes sense to keep important members of object module, too. Maybe with macros, we could be more selective (definitely keep all the common derive-related symbols though).

@Bromeon Bromeon force-pushed the 771/redundant-reexports branch 2 times, most recently from 8b93d92 to 13b966b Compare October 11, 2021 20:50
@Bromeon Bromeon marked this pull request as ready for review October 11, 2021 21:01
Copy link
Contributor

@jacobsky jacobsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The docs also appear to be building properly. Thank you for all the hard work! :)

@jacobsky
Copy link
Contributor

(There did seem to be a couple of clippy lints that were failing in nightly related to two panics though)

@Bromeon
Copy link
Member Author

Bromeon commented Oct 12, 2021

bors try

bors bot added a commit that referenced this pull request Oct 12, 2021
@bors
Copy link
Contributor

bors bot commented Oct 12, 2021

try

Build succeeded:

@Bromeon
Copy link
Member Author

Bromeon commented Oct 12, 2021

bors try

bors bot added a commit that referenced this pull request Oct 12, 2021
@bors
Copy link
Contributor

bors bot commented Oct 12, 2021

try

Build succeeded:

@Bromeon
Copy link
Member Author

Bromeon commented Oct 13, 2021

bors r+

bors bot added a commit that referenced this pull request Oct 13, 2021
788: Simplify module structure (redundant re-exports) r=Bromeon a=Bromeon

Simplifies the module structure and closes #771.

## Changes

**TLDR:**
* Every symbol lives in exactly one module (+ optionally the prelude)
* No symbols except modules at `gdnative` crate root (not even macros)
* Some module renamings for clarification
* No semantic changes -- may break imports however

**Detailed list:**
* Change `gdnative::object`
   * Now official home for `Ref`, `TRef` etc.
   * Move several verifying traits: `object` -> object::bounds
   * Move/rename `gdnative::thread_access` -> `gdnative::object::ownership`
   * Move/rename `gdnative::ref_kind` -> `gdnative::object::memory`
* Change `gdnative::core_types`
   * No more nested modules
   * Move `gdnative::GodotError` to `gdnative::object::GodotError` 
* Change `gdnative::nativescript`
   * Rename `init` -> `export`
   * Rename `profiling` -> `profiler`
   * `export` and `user_data` no longer re-exported to `nativescript`
   * `class` now private, symbols re-exported to `nativescript`
   * Macro `profile_sig!` now in `profiler`
   * Improve documentation + fix doc tests
* **Add** `gdnative::macros`
   * replaces crate root for `godot_init!` etc.
* **Add** `gdnative::derive`
   * contains derive macros and macro attributes
* Document feature flags in lib.rs and `Variant`

## Things not (yet) done
Those could be discussed in separate PRs.
* Changes to the prelude
* Clean up the modules inside `gdnative::api`
   The issue here is that the modules under `api` are used for grouping related symbols. For example, `api::node` has 3 structs `Node`, `DuplicateFlags` and `PauseMode`. In C++, they would be represented as enum/struct inside a `class Node`, however Rust does not support nested types in struct, hence the module is used. An alternative would be to remove `api::Node` and just use `api::node::Node`, but this is less ergonomic.
* Some very deep nestings, such as `gdnative::nativescript::export::property::hint::ArrayHint`

Co-authored-by: Jan Haller <[email protected]>
@bors
Copy link
Contributor

bors bot commented Oct 13, 2021

Build failed:

@Bromeon
Copy link
Member Author

Bromeon commented Oct 13, 2021

Windows CI workers did not start -- let's try again.
bors r+

bors bot added a commit that referenced this pull request Oct 13, 2021
788: Simplify module structure (redundant re-exports) r=Bromeon a=Bromeon

Simplifies the module structure and closes #771.

## Changes

**TLDR:**
* Every symbol lives in exactly one module (+ optionally the prelude)
* No symbols except modules at `gdnative` crate root (not even macros)
* Some module renamings for clarification
* No semantic changes -- may break imports however

**Detailed list:**
* Change `gdnative::object`
   * Now official home for `Ref`, `TRef` etc.
   * Move several verifying traits: `object` -> object::bounds
   * Move/rename `gdnative::thread_access` -> `gdnative::object::ownership`
   * Move/rename `gdnative::ref_kind` -> `gdnative::object::memory`
* Change `gdnative::core_types`
   * No more nested modules
   * Move `gdnative::GodotError` to `gdnative::object::GodotError` 
* Change `gdnative::nativescript`
   * Rename `init` -> `export`
   * Rename `profiling` -> `profiler`
   * `export` and `user_data` no longer re-exported to `nativescript`
   * `class` now private, symbols re-exported to `nativescript`
   * Macro `profile_sig!` now in `profiler`
   * Improve documentation + fix doc tests
* **Add** `gdnative::macros`
   * replaces crate root for `godot_init!` etc.
* **Add** `gdnative::derive`
   * contains derive macros and macro attributes
* Document feature flags in lib.rs and `Variant`

## Things not (yet) done
Those could be discussed in separate PRs.
* Changes to the prelude
* Clean up the modules inside `gdnative::api`
   The issue here is that the modules under `api` are used for grouping related symbols. For example, `api::node` has 3 structs `Node`, `DuplicateFlags` and `PauseMode`. In C++, they would be represented as enum/struct inside a `class Node`, however Rust does not support nested types in struct, hence the module is used. An alternative would be to remove `api::Node` and just use `api::node::Node`, but this is less ergonomic.
* Some very deep nestings, such as `gdnative::nativescript::export::property::hint::ArrayHint`

Co-authored-by: Jan Haller <[email protected]>
@bors
Copy link
Contributor

bors bot commented Oct 13, 2021

Build failed:

@Bromeon
Copy link
Member Author

Bromeon commented Oct 13, 2021

GitHub confirmed issues with Action runners: https://twitter.com/githubstatus/status/1448208551416041473

Or https://www.githubstatus.com/

Investigating - We are investigating reports of degraded performance for GitHub Actions.
Oct 13, 08:46 UTC

In case it's fixed within the next hour before the timeout:
bors r+

bors bot added a commit that referenced this pull request Oct 13, 2021
788: Simplify module structure (redundant re-exports) r=Bromeon a=Bromeon

Simplifies the module structure and closes #771.

## Changes

**TLDR:**
* Every symbol lives in exactly one module (+ optionally the prelude)
* No symbols except modules at `gdnative` crate root (not even macros)
* Some module renamings for clarification
* No semantic changes -- may break imports however

**Detailed list:**
* Change `gdnative::object`
   * Now official home for `Ref`, `TRef` etc.
   * Move several verifying traits: `object` -> object::bounds
   * Move/rename `gdnative::thread_access` -> `gdnative::object::ownership`
   * Move/rename `gdnative::ref_kind` -> `gdnative::object::memory`
* Change `gdnative::core_types`
   * No more nested modules
   * Move `gdnative::GodotError` to `gdnative::object::GodotError` 
* Change `gdnative::nativescript`
   * Rename `init` -> `export`
   * Rename `profiling` -> `profiler`
   * `export` and `user_data` no longer re-exported to `nativescript`
   * `class` now private, symbols re-exported to `nativescript`
   * Macro `profile_sig!` now in `profiler`
   * Improve documentation + fix doc tests
* **Add** `gdnative::macros`
   * replaces crate root for `godot_init!` etc.
* **Add** `gdnative::derive`
   * contains derive macros and macro attributes
* Document feature flags in lib.rs and `Variant`

## Things not (yet) done
Those could be discussed in separate PRs.
* Changes to the prelude
* Clean up the modules inside `gdnative::api`
   The issue here is that the modules under `api` are used for grouping related symbols. For example, `api::node` has 3 structs `Node`, `DuplicateFlags` and `PauseMode`. In C++, they would be represented as enum/struct inside a `class Node`, however Rust does not support nested types in struct, hence the module is used. An alternative would be to remove `api::Node` and just use `api::node::Node`, but this is less ergonomic.
* Some very deep nestings, such as `gdnative::nativescript::export::property::hint::ArrayHint`

Co-authored-by: Jan Haller <[email protected]>
@bors
Copy link
Contributor

bors bot commented Oct 13, 2021

Build failed:

@Bromeon
Copy link
Member Author

Bromeon commented Oct 13, 2021

bors retry

@bors
Copy link
Contributor

bors bot commented Oct 13, 2021

Build succeeded:

@bors bors bot merged commit b199535 into godot-rust:master Oct 13, 2021
@Bromeon Bromeon deleted the 771/redundant-reexports branch October 14, 2021 15:07
@Bromeon Bromeon added quality-of-life No new functionality, but improves ergonomics/internals and removed feature Adds functionality to the library labels Nov 2, 2021
bors bot added a commit that referenced this pull request Nov 9, 2021
811: Simplify module structure II r=Bromeon a=Bromeon

This PR is a continuation of #788 and addresses the remaining, somewhat ambitious tasks for module cleanup.

Goals:
* Every symbol appears at most once in prelude
* Every symbol appears at exactly once outside prelude
* 2-3 modules (inside the crate) are the maximum nesting depth
* Modules named according to related functionality from user point of view

Changes:

1. `nativescript` module
    * Rename to `export`. Rationale: "native script" is quite a wide term, while most the module's current functionality is directly related to _exporting_ symbols from Rust. In practice, godot-rust is always (?) used as a native script. Other potential use cases, as a pure Godot API library or with native_calls, seem to be the exception, if at all.
    * Along with renaming, the `nativescript` feature is removed.
    * Nested symbols in `export::{properties, methods}` are moved one level up.
    * As a result, we can avoid very long qualifiers and multiple candidates for `use` statements.
       *  `nativescript::init::property::hint::EnumHint` -> `export::hint::EnumHint`
       * `nativescript::export::method::MethodBuilder` -> `export::MethodBuilder`

1. `api` module
    * Remove inner types like `api::area::Area`, as they are already present in `api`.
    * Remove all modules which would then become empty.
    * Create doc links between class (`Camera2D`) and related module (`camera_2d`).

1. Smaller top-level modules
    * Add `init` (previously part of `nativescript`).
    * Add `profiler` (previously part of `nativescript`).
    * Extend `log` with related macros.
    * Remove `macros` and distribute its symbols to the most fitting API.

1. `prelude` module
    * Remove a few macros (`godot_gdnative_init` etc.) from the prelude, suggesting that `godot_init` should be used.
    * `user_data` symbols are accessible through `prelude::user_data` instead of `prelude` directly. This mirrors common usage in examples.

1. `core_types` module
    No changes in this PR; see PR discussion for reasons and potential alternatives.

Co-authored-by: Jan Haller <[email protected]>
bors bot added a commit that referenced this pull request Nov 9, 2021
811: Simplify module structure II r=Bromeon a=Bromeon

This PR is a continuation of #788 and addresses the remaining, somewhat ambitious tasks for module cleanup.

Goals:
* Every symbol appears at most once in prelude
* Every symbol appears at exactly once outside prelude
* 2-3 modules (inside the crate) are the maximum nesting depth
* Modules named according to related functionality from user point of view

Changes:

1. `nativescript` module
    * Rename to `export`. Rationale: "native script" is quite a wide term, while most the module's current functionality is directly related to _exporting_ symbols from Rust. In practice, godot-rust is always (?) used as a native script. Other potential use cases, as a pure Godot API library or with native_calls, seem to be the exception, if at all.
    * Along with renaming, the `nativescript` feature is removed.
    * Nested symbols in `export::{properties, methods}` are moved one level up.
    * As a result, we can avoid very long qualifiers and multiple candidates for `use` statements.
       *  `nativescript::init::property::hint::EnumHint` -> `export::hint::EnumHint`
       * `nativescript::export::method::MethodBuilder` -> `export::MethodBuilder`

1. `api` module
    * Remove inner types like `api::area::Area`, as they are already present in `api`.
    * Remove all modules which would then become empty.
    * Create doc links between class (`Camera2D`) and related module (`camera_2d`).

1. Smaller top-level modules
    * Add `init` (previously part of `nativescript`).
    * Add `profiler` (previously part of `nativescript`).
    * Extend `log` with related macros.
    * Remove `macros` and distribute its symbols to the most fitting API.

1. `prelude` module
    * Remove a few macros (`godot_gdnative_init` etc.) from the prelude, suggesting that `godot_init` should be used.
    * `user_data` symbols are accessible through `prelude::user_data` instead of `prelude` directly. This mirrors common usage in examples.

1. `core_types` module
    No changes in this PR; see PR discussion for reasons and potential alternatives.

Co-authored-by: Jan Haller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Issues and PRs that are breaking to fix/merge. c: bindings Component: GDNative bindings (mod api) c: core Component: core (mod core_types, object, log, init, ...) documentation quality-of-life No new functionality, but improves ergonomics/internals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up redundant re-exports
3 participants