-
Notifications
You must be signed in to change notification settings - Fork 211
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
[tracker] Tidy public internal interfaces #357
Comments
It appears that the remaining public functions are used across crates in the workspace. Were there specific functions you had in mind? |
@halzy All the generated unsafe methods in |
Could you elaborate a bit more? |
@halzy These types are used in the Otherwise, if there aren't any uses for them, we can also remove the arguments from the signatures of callbacks. |
477: [357] Sealing access::{Guard, WritePtr} r=toasteater a=halzy Resolves part of #357 `Traits that are #[doc(hidden)] but should be public and sealed` Co-authored-by: Benjamin Halsted <[email protected]>
To facilitate macros and generated bindings, the bindings expose a considerable number of internal interfaces that are
pub
at the language level. This alone is not a problem. However, they currently float freely in the codebase, and have inconsistent#[doc(hidden)]
attributes. There are also some items that are unnecessarily#[doc(hidden)] pub
. This complicates maintenance and future improvements (support for multiple engine versions, for example).As a general rule, all items that expose types from
gdnative-sys
will be considered internal starting 0.9 (#291). If there are no higher-level replacements for them, such wrappers should be created.Following is a non-exhaustive listing of items that need attention. New instances may be added here as they are discovered.
Top-level items in
gdnative-core
These are mostly used in macros, and will be moved to a module named
private
that is#[doc(hidden)] pub
. There are two items without#[doc(hidden)]
,result_from_sys
andreport_init_error
, that need special intervention:result_from_sys
in 0.8.1. It will be replaced with afrom_sys
method onGodotError
. (Top-level hidden interface cleanup #360)report_init_error
is not released yet. Move it toprivate
directly in 0.8.1. (Top-level hidden interface cleanup #360)GODOT_API
andGDNATIVE_LIBRARY_SYS
fully private. (Top-level hidden interface cleanup #360)Generated unsafe methods in
bindings_methods.rs
These are only used in the generated inherent methods, and thus should simply be private.
fn
s andstruct
s private. #418)this
field in generated binding typesThese should also just be private. Macros should use
to_sys()
instead.this
fields private. (#357: Makethis
fields private. #405)GodotObject
and similar traitsThe
GodotObject
trait is only meant to be implemented by the binding generator. However, there has been confused users trying to implement it (usually because they want downcasting). The trait should be "semi-sealed" with a supertrait ingdnative_code::private
.GodotObject
in 0.8.1 (Semi-seal the GodotObject trait. #368)free_on_drop::Free
in 0.9 (Remove deprecated items from the public interface #408)free_on_drop::QueueFree
in 0.9 (Remove deprecated items from the public interface #408)Traits that are `#[doc(hidden)] but should be public and sealed
access::Guard
([357] Sealing access::{Guard, WritePtr} #477)access::WritePtr
([357] Sealing access::{Guard, WritePtr} #477)The
Export
trait andExportInfo
It's not sure if
Export
should be sealed, since making custom types usable in properties is a reasonable use case. However,ExportInfo
exposessys::godot_property_hint
as a public field, making it unsuitable to be public interface in future versions. The current plan is to deprecate the public fields inExportInfo
and make them private in 0.9.ExportInfo
in 0.8.1. (Deprecate public fields of ExportInfo #362)ExportInfo
private in 0.9. (Remove deprecated items from the public interface #408)init_handle
field ofClassBuilder
ClassBuilder::init_handle
private. (#357: make init_handle private #404)sys::godot_gdnative_terminate_options
argument ingodot_gdnative_init
andgdnative_terminate
callbacksinit_options
in 0.9.terminate_options
in 0.9.Opinions and items to add to the list are welcome!
The text was updated successfully, but these errors were encountered: