Skip to main content

service

Attribute Macro service 

Source
#[service]
Expand description

Service attribute macro for creating RPC services

§Attributes

  • async_trait - Use async_trait instead of the default make(Send + Sync)
  • tracing - Enable auto-instrumentation for all methods
  • uses(path::to::mod::*) - Add use statements to the generated protocol module. Multiple paths can be specified: uses(some::mod::*, other::mod::Type)

§Example

#[service(uses(some::mod::*, other::mod::Type))]
pub trait Backend {
    async fn read_commit(&mut self, id: CommitId) -> Result<Commit>;
}