Skip to content

Add macro that registers guest policy endpoints #13

@ereslibre

Description

@ereslibre

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions