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

Add macro that registers guest policy endpoints #13

Open
ereslibre opened this issue May 14, 2021 · 0 comments
Open

Add macro that registers guest policy endpoints #13

ereslibre opened this issue May 14, 2021 · 0 comments

Comments

@ereslibre
Copy link
Member

When writing a policy with this SDK, the policy has to implement some boilerplate:

#[no_mangle]
pub extern "C" fn wapc_init() {
    register_function("validate", validate);
    register_function("validate_settings", validate_settings::<Settings>);
    register_function("protocol_version", protocol_version_guest);
}

Add a macro that generates this code automatically, something like:

guest_entrypoints!(
  validate => validate,
  validate_settings => Settings,
)

The protocol_version will be automatically set by the macro to a generated function that returns the default ProtocolVersion with the current protocol version of the SDK being used by the policy.

Naming can likely be improved :)

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

No branches or pull requests

1 participant