Skip to content
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

testing thing #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

testing thing #1

wants to merge 5 commits into from

Conversation

lilizoey
Copy link
Owner

foo

@lilizoey lilizoey force-pushed the master branch 2 times, most recently from 20d6dd6 to 0188799 Compare April 13, 2024 00:48
lilizoey pushed a commit that referenced this pull request Oct 15, 2024
The style is similar to GDScript's @rpc annotation, the macro can be used as follows:

#1 - Separate arguments:
```rust
#[rpc(any_peer, reliable)]
fn some_rpc(&mut self) {
    //..
}
```

Providing overlapping arguments generates a compile error.

Any omitted arguments are set to their default values.

#2 - Provide an expression:
```rust
const CONFIG: RpcArgs = RpcArgs {
    mode: RpcMode::Authority,
    ..RpcArgs::default()
};

#[rpc(config = CONFIG_EXPR)]
fn some_rpc(&mut self) {
    //..
}
```

Number #2 is useful in case you want to reuse the configuration on multiple functions.

Number #2 is mutually exclusive with number #1.
---

The generated macro code works as follows:
- Caches the configuration in a `ClassPlugin`.
- On `__before_ready()`, searches for the configuration in the plugin, registering them with Node::rpc_config().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant