#web #marco #actix #loginmanager

macro loginmanager-codegen

The macro for actix-loginmanager

1 unstable release

0.0.1 Jul 26, 2021

#14 in #marco

25 downloads per month
Used in actix-loginmanager

MIT/Apache

6KB
60 lines

login_required macros for actix-loginmanager

Syntax

#[login_required(UserType,name="user")]

Attributes

  • UserType - Define the variable type.
  • name="user" - Define the variable name.

Example

use actix_loginmanager::login_required;
// define or import `user` which implements `UserMinix` trait.

#[login_required(User)]
async fn hello()->impl actix_web::Responder{
    user.is_actived(); //can access user:Rc<User>
    return "hello";
}

#[login_required(User,name="user")]
async fn hello()->impl actix_web::Responder{
    user.is_actived(); //can access user:Rc<User>
    return "hello";
}

lib.rs:

login_required macros for actix-loginmanager

Example

use actix_loginmanager::login_required;
// define or import `user` which implements `UserMinix` trait.

#[login_required(User)]
async fn hello()->impl actix_web::Responder{
    user.is_actived(); //can access user:Rc<User>
    return "hello";
}

#[login_required(User, name="user")]
async fn hello()->impl actix_web::Responder{
    user.is_actived(); //can access user:Rc<User>
    return "hello";
}

Dependencies

~1.5MB
~33K SLoC