Skip to content

Commit bb48d74

Browse files
committed
Remove is_standard
Add more extensive documentation to is_custom Change documentation of `method_name` to reflect godot#73052
1 parent 61b4e34 commit bb48d74

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

godot-core/src/builtin/callable.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,16 @@ impl Callable {
6363
self.as_inner().callv(arguments)
6464
}
6565

66-
/// Returns the name of the method represented by this callable.
66+
/// Returns the name of the method represented by this callable. If the callable is a lambda function,
67+
/// returns the function's name.
68+
///
69+
/// ## Known Bugs
70+
///
71+
/// Getting the name of a lambda errors instead of returning its name, see [godot#73052].
6772
///
6873
/// _Godot equivalent: `get_method`_
74+
///
75+
/// [godot#73052]: https://github.com/godotengine/godot/issues/73052
6976
pub fn method_name(&self) -> Option<StringName> {
7077
let method_name = self.as_inner().get_method();
7178
if method_name.is_empty() {
@@ -111,7 +118,13 @@ impl Callable {
111118
/// Custom callables are mainly created from bind or unbind. In GDScript, lambda functions are also
112119
/// custom callables.
113120
///
121+
/// If a callable is not a custom callable, then it is considered a standard callable, this function is
122+
/// the opposite of [`Callable.is_standard`].
123+
///
114124
/// _Godot equivalent: `is_custom`_
125+
///
126+
/// [`Callable.is_standard`]: https://docs.godotengine.org/en/stable/classes/class_callable.html#class-callable-method-is-standard
127+
#[doc(alias = "is_standard")]
115128
pub fn is_custom(&self) -> bool {
116129
self.as_inner().is_custom()
117130
}
@@ -126,15 +139,6 @@ impl Callable {
126139
self.as_inner().is_null()
127140
}
128141

129-
/// Returns true if this callable is a standard callable. This method is the opposite of [`is_custom`].
130-
///
131-
/// Returns `false` if this callable is a lambda function.
132-
///
133-
/// _Godot equivalent: `is_standard`_
134-
pub fn is_standard(&self) -> bool {
135-
self.as_inner().is_standard()
136-
}
137-
138142
/// Returns true if the callable's object exists and has a valid method name assigned, or is a custom
139143
/// callable.
140144
///

itest/rust/src/callable_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ fn callable_validity() {
3838
let obj = Gd::<CallableTestObj>::new_default();
3939
assert!(!obj.callable("doesn't_exist").is_valid());
4040
assert!(!obj.callable("doesn't_exist").is_null());
41-
assert!(obj.callable("doesn't_exist").is_standard());
4241
assert!(!obj.callable("doesn't_exist").is_custom());
4342
assert!(obj.callable("foo").is_valid());
4443
assert!(Callable::default().is_null());
44+
assert!(!Callable::default().is_custom());
4545
}
4646

4747
#[itest]

0 commit comments

Comments
 (0)