gofractally / psibase

Open source protocol enabling communities to easily self-host web applications
https://docs.psibase.io
MIT License
28 stars 7 forks source link

Support for asserting service initialization in rust #879

Open James-Mart opened 1 month ago

James-Mart commented 1 month ago

Background

In C++, we have the ability to write some code in the constructor of a service that is called on every action invocation that verifies that the init action on the service was called. This prevents other services from using the service before it was initialized. In Rust, since there is no service constructor, we currently do not support this.

Scope

In Rust, we will add a #[pre_action] attribute that can specify a function that should run before every action

cc @swatanabe