Skip to main content

serverless

Attribute Macro serverless 

Source
#[serverless]
Expand description

Attribute macro for marking a function as a serverless function.

This macro generates:

  • The original function implementation
  • A client stub for remote calls (when remote_call feature is enabled)
  • A wrapper function for local calls (when local_call feature is enabled)
  • Server registration code for automatic function discovery

§Example

use serverless_fn::{serverless, ServerlessError};

#[serverless]
pub async fn hello(name: String) -> Result<String, ServerlessError> {
    Ok(format!("Hello, {}!", name))
}