patch

Attribute Macro patch 

Source
#[patch]
Expand description

Defines an HTTP PATCH route.

This macro registers a function as a handler for PATCH requests. It takes a required url parameter to specify the endpoint path.

§Asynchronous Execution

Functions annotated with patch are executed asynchronously.
You do not need to explicitly mark them as async, as the macro automatically ensures async execution.
This means you can freely use .await inside these functions.

§Parameters

  • url: (required) The endpoint URL pattern.

§Return Type

The function’s return type can be any Rust primitive or a type implementing Serialize from serde.

§Example

#[patch(url = "/patch_example")]
fn handle_patch() -> String {
    "Patched".to_string()
}