cling_handler

Attribute Macro cling_handler 

Source
#[cling_handler]
Expand description

Macro that adds a few assertions to help you investigate errors if the compiler is not happy about a handler signature.

ยงExample:

use cling::prelude::*;

#[cling_handler]
pub async fn create_project(
    State(session): State<Session>,
    args: &CreateProjectArgs,
) -> anyhow::Result<()> {
    println!(
        "Creating project '{}' for user {}.",
        args.name, session.user_id
    );
    println!("Would have created the project here");
    Ok(())
}