-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #378 from you-win/feature/func-renaming
Feature/func renaming
- Loading branch information
Showing
7 changed files
with
113 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
use godot::prelude::*; | ||
|
||
#[derive(GodotClass)] | ||
#[class(base=RefCounted)] | ||
struct FuncRename; | ||
|
||
#[godot_api] | ||
impl FuncRename { | ||
#[func(rename=is_true)] | ||
fn long_function_name_for_is_true(&self) -> bool { | ||
true | ||
} | ||
|
||
#[func(rename=give_one)] | ||
fn give_one_inner(&self) -> i32 { | ||
self.give_one() | ||
} | ||
|
||
#[func(rename=spell_static)] | ||
fn renamed_static() -> GodotString { | ||
GodotString::from("static") | ||
} | ||
} | ||
|
||
impl FuncRename { | ||
/// Unused but present to demonstrate how `rename = ...` can be used to avoid name clashes. | ||
#[allow(dead_code)] | ||
fn is_true(&self) -> bool { | ||
false | ||
} | ||
|
||
fn give_one(&self) -> i32 { | ||
1 | ||
} | ||
} | ||
|
||
#[godot_api] | ||
impl RefCountedVirtual for FuncRename { | ||
fn init(_base: Base<Self::Base>) -> Self { | ||
Self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters