-
-
Notifications
You must be signed in to change notification settings - Fork 224
Fix (no base)
showing up in all the docs
#229
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
Conversation
bors try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 🙂
I don't think we need both a default value and Option
-- there should be only one way to represent the "absent" state. Since Godot interprets the empty string as "there is no class name" (correct me if I'm wrong), the default value is more natural, and we don't need Option
at all.
@@ -13,7 +13,7 @@ use crate::obj::GodotClass; | |||
|
|||
/// Utility to construct class names known at compile time. | |||
/// Cannot be a function since the backing string must be retained. | |||
#[derive(Eq, PartialEq, Hash, Clone, Debug)] | |||
#[derive(Default, Eq, PartialEq, Hash, Clone, Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a line that says that the default value (empty string) represents no class name.
Alternatively, there could be an explicit function ClassName::none()
.
tryBuild succeeded: |
About the test, a random idea would be to check Godot's reflection APIs, such as The Otherwise, it's also totally fine if we don't test everything programmatically 🙂 |
I dont think it'll help much, as we want to make sure that the method info we output is rendered properly. but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True; I was actually looking for a method that would return something like a doc string, but couldn't find any.
The method list was the 2nd best option, but you're right that it might just give us what we enter. This would still test that within gdext, we end up passing the right value for class names, but this is not really giving us anything at the current complexity.
/// In Godot, an empty `StringName` in a place that expects a class name, means that there is no class. | ||
pub fn none() -> Self { | ||
Self::default() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant "alternatively" as in "not providing default".
This avoids accidental implicit construction (we also don't need 2 methods doing the same thing here).
/// In Godot, an empty `StringName` in a place that expects a class name, means that there is no class. | |
pub fn none() -> Self { | |
Self::default() | |
} | |
/// In Godot, an empty `StringName` in a place that expects a class name, means that there is no class. | |
pub fn none() -> Self { | |
Self { | |
backing: StringName::default(), | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
bors r+
Build succeeded: |
We were setting
class_name
to be(no base)
in thePropertyInfo
for all types by default. However that makes godot show theclass_name
in return values and arguments.I dont know if there's a good way to test this? It would involve us checking what documentation is generated by godot which doesn't seem like something we can easily do.
closes #159