Extract doc-comment on plugin functions.

This commit is contained in:
Stephen Chung
2021-12-21 16:14:07 +08:00
parent f74486f904
commit b85a9b3c1c
11 changed files with 275 additions and 21 deletions

View File

@@ -0,0 +1,18 @@
use rhai::plugin::*;
#[export_module]
pub mod test_module {
#[rhai_fn(name = "test")]
#[rhai_fn(pure)]
pub fn test_fn(input: Point) -> bool {
input.x > input.y
}
}
fn main() {
if test_module::test_fn(n) {
println!("yes");
} else {
println!("no");
}
}

View File

@@ -0,0 +1,17 @@
error: duplicated attribute 'rhai_fn'
--> ui_tests/rhai_fn_duplicate_attr.rs:6:5
|
6 | #[rhai_fn(pure)]
| ^^^^^^^^^^^^^^^^
error[E0433]: failed to resolve: use of undeclared crate or module `test_module`
--> ui_tests/rhai_fn_duplicate_attr.rs:13:8
|
13 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of undeclared crate or module `test_module`
error[E0425]: cannot find value `n` in this scope
--> ui_tests/rhai_fn_duplicate_attr.rs:13:29
|
13 | if test_module::test_fn(n) {
| ^ not found in this scope