You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
0 commit comments